(self)
| 316 | self.assertEqualMetrics([a, b], list(families)) |
| 317 | |
| 318 | def test_roundtrip(self): |
| 319 | text = """# HELP go_gc_duration_seconds A summary of the GC invocation durations. |
| 320 | # TYPE go_gc_duration_seconds summary |
| 321 | go_gc_duration_seconds{quantile="0"} 0.013300656000000001 |
| 322 | go_gc_duration_seconds{quantile="0.25"} 0.013638736 |
| 323 | go_gc_duration_seconds{quantile="0.5"} 0.013759906 |
| 324 | go_gc_duration_seconds{quantile="0.75"} 0.013962066 |
| 325 | go_gc_duration_seconds{quantile="1"} 0.021383540000000003 |
| 326 | go_gc_duration_seconds_sum 56.12904785 |
| 327 | go_gc_duration_seconds_count 7476.0 |
| 328 | # HELP go_goroutines Number of goroutines that currently exist. |
| 329 | # TYPE go_goroutines gauge |
| 330 | go_goroutines 166.0 |
| 331 | # HELP prometheus_local_storage_indexing_batch_duration_milliseconds Quantiles for batch indexing duration in milliseconds. |
| 332 | # TYPE prometheus_local_storage_indexing_batch_duration_milliseconds summary |
| 333 | prometheus_local_storage_indexing_batch_duration_milliseconds{quantile="0.5"} NaN |
| 334 | prometheus_local_storage_indexing_batch_duration_milliseconds{quantile="0.9"} NaN |
| 335 | prometheus_local_storage_indexing_batch_duration_milliseconds{quantile="0.99"} NaN |
| 336 | prometheus_local_storage_indexing_batch_duration_milliseconds_sum 871.5665949999999 |
| 337 | prometheus_local_storage_indexing_batch_duration_milliseconds_count 229.0 |
| 338 | # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. |
| 339 | # TYPE process_cpu_seconds_total counter |
| 340 | process_cpu_seconds_total 29323.4 |
| 341 | # HELP process_virtual_memory_bytes Virtual memory size in bytes. |
| 342 | # TYPE process_virtual_memory_bytes gauge |
| 343 | process_virtual_memory_bytes 2.478268416e+09 |
| 344 | # HELP prometheus_build_info A metric with a constant '1' value labeled by version, revision, and branch from which Prometheus was built. |
| 345 | # TYPE prometheus_build_info gauge |
| 346 | prometheus_build_info{branch="HEAD",revision="ef176e5",version="0.16.0rc1"} 1.0 |
| 347 | # HELP prometheus_local_storage_chunk_ops_total The total number of chunk operations by their type. |
| 348 | # TYPE prometheus_local_storage_chunk_ops_total counter |
| 349 | prometheus_local_storage_chunk_ops_total{type="clone"} 28.0 |
| 350 | prometheus_local_storage_chunk_ops_total{type="create"} 997844.0 |
| 351 | prometheus_local_storage_chunk_ops_total{type="drop"} 1.345758e+06 |
| 352 | prometheus_local_storage_chunk_ops_total{type="load"} 1641.0 |
| 353 | prometheus_local_storage_chunk_ops_total{type="persist"} 981408.0 |
| 354 | prometheus_local_storage_chunk_ops_total{type="pin"} 32662.0 |
| 355 | prometheus_local_storage_chunk_ops_total{type="transcode"} 980180.0 |
| 356 | prometheus_local_storage_chunk_ops_total{type="unpin"} 32662.0 |
| 357 | # HELP "my.utf8.metric.#{}=" A fancy metric with dots. |
| 358 | # TYPE "my.utf8.metric.#{}=" summary |
| 359 | {"my.utf8.metric.#{}=",quantile="0"} 0.013300656000000001 |
| 360 | {"my.utf8.metric.#{}=",quantile="0.25"} 0.013638736 |
| 361 | {"my.utf8.metric.#{}=",quantile="0.5"} 0.013759906 |
| 362 | {"my.utf8.metric.#{}=",quantile="0.75"} 0.013962066 |
| 363 | {"my.utf8.metric.#{}=",quantile="1"} 0.021383540000000003 |
| 364 | {"my.utf8.metric.#{}=_sum"} 56.12904785 |
| 365 | {"my.utf8.metric.#{}=_count"} 7476.0 |
| 366 | """ |
| 367 | families = list(text_string_to_metric_families(text)) |
| 368 | |
| 369 | class TextCollector: |
| 370 | def collect(self): |
| 371 | return families |
| 372 | |
| 373 | registry = CollectorRegistry() |
| 374 | registry.register(TextCollector()) |
| 375 | self.assertEqual(text.encode('utf-8'), generate_latest(registry, ALLOWUTF8)) |
nothing calls this directly
no test coverage detected