Open
Description
Currently prometheus_client.exposition.write_to_textfile
doesn't support the OpenMetrics text format, which I'm addressing with this (private) hack:
from prometheus_client.openmetrics.exposition import (
generate_latest as generate_latest_openmetrics,
)
from prometheus_client.registry import CollectorRegistry
def write_openmetrics_to_textfile(path: str, registry: CollectorRegistry) -> None:
"""
Fork of `prometheus_client.exposition.write_to_textfile`, as the project
didn't provide an OpenMetrics variant of this helper function.
"""
with open(path, "wb") as fp:
fp.write(generate_latest_openmetrics(registry))
Would your project be interested in a non-hacky (as is the case above) OpenMetrics support for textfile collector?
Metadata
Metadata
Assignees
Labels
No labels