public AppMetr(String token, String url, IBatchPersister batchPersister = null) { Log.InfoFormat("Start Appmetr for token={0}, url={1}", token, url); _token = token; _url = url; _batchPersister = batchPersister ?? new MemoryBatchPersister(); _flushTimer = new AppMetrTimer(FlushPeriod, Flush, "FlushJob"); new Thread(_flushTimer.Start).Start(); _uploadTimer = new AppMetrTimer(UploadPeriod, Upload, "UploadJob"); new Thread(_uploadTimer.Start).Start(); }
public AppMetr( string token, string url, IBatchPersister batchPersister = null, IJsonSerializer serializer = null) { _log.InfoFormat("Start Appmetr for token={0}, url={1}", token, url); _token = token; _url = url; _batchPersister = batchPersister ?? new MemoryBatchPersister(); _httpRequestService = new HttpRequestService(serializer ?? new BasicJsonSerializer()); _batchPersister.SetServerId(Guid.NewGuid().ToString()); _flushTimer = new AppMetrTimer(FlushPeriod, Flush, "FlushJob"); new Thread(_flushTimer.Start).Start(); _uploadTimer = new AppMetrTimer(UploadPeriod, Upload, "UploadJob"); new Thread(_uploadTimer.Start).Start(); }