diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2025-05-14 18:03:36 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2025-05-14 18:14:29 +0300 |
commit | 7023fcf3f154c4c81eacca1475db7ca10293ee3b (patch) | |
tree | 9702d653cde52f40b2b3ce53fa37f492fd637cb0 /library/python/monlib/ut/py3 | |
parent | 05895f5bdfdbfd3ed8b1d9845ab2e927ea62fb9a (diff) | |
download | ydb-7023fcf3f154c4c81eacca1475db7ca10293ee3b.tar.gz |
Intermediate changes
commit_hash:46bf4949f5afb2187946e54da572ae0599b516a0
Diffstat (limited to 'library/python/monlib/ut/py3')
-rw-r--r-- | library/python/monlib/ut/py3/test.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/library/python/monlib/ut/py3/test.py b/library/python/monlib/ut/py3/test.py index 75cd0494cdb..4017509bc7e 100644 --- a/library/python/monlib/ut/py3/test.py +++ b/library/python/monlib/ut/py3/test.py @@ -458,3 +458,39 @@ def test_mem_only_metrics(): bucket_count=5, base=2 ) + + +def test_prometheus_conversion(request): + JSON_METRICS = """{ + "sensors": + [ + { + "kind":"GAUGE", + "labels": + { + "name":"gauge-metric" + }, + "value":10 + }, + { + "kind":"RATE", + "labels": + { + "name":"rate-metric" + }, + "value":20 + } + ] + }""" + EXPECTED = "\n".join( + [ + "# TYPE gauge_metric gauge", + "gauge_metric 10", + "# TYPE rate_metric counter", + "rate_metric 20", + "", + "", + ] + ).encode('utf-8') + result = loads(JSON_METRICS, from_format='json', to_format='prometheus', metric_name_label='name') + assert result == EXPECTED |