public void MetricConverterTest() { var metrics = new Metrics(); CounterMetric counter = metrics.Counter("test", "CounterMetric"); HistogramMetric histogramMetric = metrics.Histogram("test", "HistogramMetric"); GaugeMetric gaugeMetric = metrics.Gauge("test", "GaugeMetric", GetNumberOfUsersLoggedIn); DataDogReporter reporter = CreateDefaultReporter(metrics); TestRequest request = new TestRequest(); reporter.TransformMetrics(request, metrics, 0); IDictionary <string, DatadogSeries> convertedMetrics = request.Metrics; Assert.AreEqual(12, convertedMetrics.Count); }
public void SingleCounterTest() { var metrics = new Metrics(); string metricName = "CounterMetric"; CounterMetric counter = metrics.Counter("test", metricName); DataDogReporter reporter = CreateDefaultReporter(metrics); TestRequest request = new TestRequest(); reporter.TransformMetrics(request, metrics, 0); IDictionary <string, DatadogSeries> convertedMetrics = request.Metrics; Assert.AreEqual(1, convertedMetrics.Count); DatadogSeries metric = convertedMetrics[APP + "." + DOMAIN + "." + metricName]; Assert.NotNull(metric); Assert.IsTrue(metric is DatadogCounter); ValidateDefaultTags(metric.Tags); }
public void SingleGaugeTest() { var metrics = new Metrics(); string metricName = "GaugeMetric"; GaugeMetric gaugeMetric = metrics.Gauge("test", metricName, GetNumberOfUsersLoggedIn); DataDogReporter reporter = CreateDefaultReporter(metrics); TestRequest request = new TestRequest(); reporter.TransformMetrics(request, metrics, 0); IDictionary <string, DatadogSeries> convertedMetrics = request.Metrics; Assert.AreEqual(1, convertedMetrics.Count); DatadogSeries metric = convertedMetrics[APP + "." + DOMAIN + "." + metricName]; Assert.NotNull(metric); Assert.IsTrue(metric is DatadogGauge); ValidateDefaultTags(metric.Tags); }
public void SingleTimerTest() { var metrics = new Metrics(); string metricName = "TimerMetric"; TimerMetric timerMetric = metrics.Timer("test", metricName, TimeUnit.Seconds, TimeUnit.Seconds); DataDogReporter reporter = CreateDefaultReporter(metrics); TestRequest request = new TestRequest(); reporter.TransformMetrics(request, metrics, 0); IDictionary <string, DatadogSeries> convertedMetrics = request.Metrics; Assert.AreEqual(8, convertedMetrics.Count); foreach (TimerMetrics timerName in TimerMetrics.AllMetrics) { DatadogSeries metric = convertedMetrics[APP + "." + DOMAIN + "." + metricName + "." + timerName.GetDatadogName()]; Assert.NotNull(metric); Assert.IsTrue(metric is DatadogGauge); ValidateDefaultTags(metric.Tags); } }
public void SingleHistogramTest() { var metrics = new Metrics(); string metricName = "HistogramrMetric"; HistogramMetric histogramMetric = metrics.Histogram("test", metricName); DataDogReporter reporter = CreateDefaultReporter(metrics); TestRequest request = new TestRequest(); reporter.TransformMetrics(request, metrics, 0); IDictionary <string, DatadogSeries> convertedMetrics = request.Metrics; Assert.AreEqual(10, convertedMetrics.Count); foreach (HistogramMetrics histoName in HistogramMetrics.AllMetrics) { DatadogSeries metric = convertedMetrics[APP + "." + DOMAIN + "." + metricName + "." + histoName.GetDatadogName()]; Assert.NotNull(metric); Assert.IsTrue(metric is DatadogGauge); ValidateDefaultTags(metric.Tags); } }