(self)
| 605 | self.assertEqual([metric_family], list(families)) |
| 606 | |
| 607 | def test_timestamps(self): |
| 608 | families = text_string_to_metric_families("""# TYPE a counter |
| 609 | # HELP a help |
| 610 | a_total{foo="1"} 1 000 |
| 611 | a_total{foo="2"} 1 0.0 |
| 612 | a_total{foo="3"} 1 1.1 |
| 613 | a_total{foo="4"} 1 12345678901234567890.1234567890 |
| 614 | a_total{foo="5"} 1 1.5e3 |
| 615 | # TYPE b counter |
| 616 | # HELP b help |
| 617 | b_total 2 1234567890 |
| 618 | # EOF |
| 619 | """) |
| 620 | a = CounterMetricFamily("a", "help", labels=["foo"]) |
| 621 | a.add_metric(["1"], 1, timestamp=Timestamp(0, 0)) |
| 622 | a.add_metric(["2"], 1, timestamp=Timestamp(0, 0)) |
| 623 | a.add_metric(["3"], 1, timestamp=Timestamp(1, 100000000)) |
| 624 | a.add_metric(["4"], 1, timestamp=Timestamp(12345678901234567890, 123456789)) |
| 625 | a.add_metric(["5"], 1, timestamp=1500.0) |
| 626 | b = CounterMetricFamily("b", "help") |
| 627 | b.add_metric([], 2, timestamp=Timestamp(1234567890, 0)) |
| 628 | self.assertEqual([a, b], list(families)) |
| 629 | |
| 630 | def test_hash_in_label_value(self): |
| 631 | families = text_string_to_metric_families("""# TYPE a counter |
nothing calls this directly
no test coverage detected