Skip to content

Commit

Permalink
Fix test_non_monotonic_sum_to_prometheus after changes from open-tele…
Browse files Browse the repository at this point in the history
  • Loading branch information
brettimus authored and Brett Beutell committed Jul 14, 2023
1 parent baa1e61 commit 22f98f9
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_histogram_to_prometheus(self):
def test_monotonic_sum_to_prometheus(self):
labels = {"environment@": "staging", "os": "Windows"}
metric = _generate_sum(
"test@sum",
"test@sum_monotonic",
123,
attributes=labels,
description="testdesc",
Expand Down Expand Up @@ -156,7 +156,9 @@ def test_monotonic_sum_to_prometheus(self):

for prometheus_metric in collector.collect():
self.assertEqual(type(prometheus_metric), CounterMetricFamily)
self.assertEqual(prometheus_metric.name, "test_sum_testunit")
self.assertEqual(
prometheus_metric.name, "test_sum_monotonic_testunit"
)
self.assertEqual(prometheus_metric.documentation, "testdesc")
self.assertTrue(len(prometheus_metric.samples) == 1)
self.assertEqual(prometheus_metric.samples[0].value, 123)
Expand All @@ -171,7 +173,7 @@ def test_monotonic_sum_to_prometheus(self):
def test_non_monotonic_sum_to_prometheus(self):
labels = {"environment@": "staging", "os": "Windows"}
metric = _generate_sum(
"test@sum",
"test@sum_nonmonotonic",
123,
attributes=labels,
description="testdesc",
Expand All @@ -195,12 +197,14 @@ def test_non_monotonic_sum_to_prometheus(self):
]
)

collector = _CustomCollector()
collector = _CustomCollector(disable_target_info=True)
collector.add_metrics_data(metrics_data)

for prometheus_metric in collector.collect():
self.assertEqual(type(prometheus_metric), GaugeMetricFamily)
self.assertEqual(prometheus_metric.name, "test_sum_testunit")
self.assertEqual(
prometheus_metric.name, "test_sum_nonmonotonic_testunit"
)
self.assertEqual(prometheus_metric.documentation, "testdesc")
self.assertTrue(len(prometheus_metric.samples) == 1)
self.assertEqual(prometheus_metric.samples[0].value, 123)
Expand Down

0 comments on commit 22f98f9

Please sign in to comment.