/// <summary> /// The main entry point for the application. /// </summary> static void Main() { while (true) { try { log.Info("Starting Main"); MetricsServiceSettings settings = new MetricsServiceSettings(); Program.project = getProject(); Program.reader = makeMetricsReader(project, settings); Program.exporter = makseMetricsExporter(settings); log.Info("Created Dependencies"); reader.VariablesUpdated += (object sender, VariablesUpdatedEventArgs args) => exporter.SendMetric(args.variables); var ServiceToRun = new ZenOnMetricsExporterService(reader); log.Info("Created Service"); ServiceToRun.OnStart(); log.Info("Service Running"); log.Info($"Waiting for thread to exit {ServiceToRun.readerThread.ThreadState}"); ServiceToRun.readerThread.Join(); log.Info($"Thread exited {ServiceToRun.readerThread.ThreadState}"); } catch (Exception ex) { log.Error(ex); Thread.Sleep(OneMinute); } } }
public async Task QueryRangeTest() { var reader = new MetricsReader(); int maxResultCount = 5; var results = await reader.QueryAsync <DynamicTableEntity>(_SubjectIds[0], _SubjectIds[3], _SubjectTypeIds[0], maxResultCount); Assert.IsTrue(results.Count <= maxResultCount); }
public async Task QueryListTest() { var reader = new MetricsReader(); int maxResultCount = 5; var results = await reader.QueryAsync <DynamicTableEntity>(new List <int> { _SubjectIds[0], _SubjectIds[3] }, _SubjectTypeIds[0], maxResultCount); Assert.IsTrue(results.Count <= maxResultCount, $" {nameof(maxResultCount)} is '{maxResultCount}'. Count of results is '{results.Count}'"); }
public async Task QueryPointsTest() { var reader = new MetricsReader(_Settings); int maxResultCount = 5; var results = await reader.QueryPointsAsync <DynamicTableEntity>(new List <int> { _SubjectIds[0], _SubjectIds[3], _SubjectIds[20], _SubjectIds[19], _SubjectIds[18], _SubjectIds[_SubjectIds.Length - 1] }, _SubjectTypeIds[1], maxResultCount); Assert.IsTrue(results.Count <= maxResultCount, $" {nameof(maxResultCount)} is '{maxResultCount}'. Count of results is '{results.Count}'"); }
public ZenOnMetricsExporterService(MetricsReader reader) { this.metricsReader = reader; }
static MetricsReader makeMetricsReader(IProject project, MetricsServiceSettings settings) { var reader = new MetricsReader(project, poolInterval: Convert.ToInt32(settings.PoolIntervalMs)); return(reader); }