aioprometheus.renderer module

aioprometheus.renderer.render(registry: aioprometheus.collectors.Registry, accepts_headers: Sequence[str]) Tuple[bytes, dict]

Render the metrics in this registry to a specific format.

The format chosen is determined by scanning through the ACCEPTS headers and selecting the most efficient format. If no accepts headers information is provided then Text format is used as the default.

Parameters
  • registry – A collector registry that contains the metrics to be rendered into a specific format.

  • accepts_headers – a list of ACCEPT headers fields extracted from a request.

Returns

a 2-tuple where the first item is a bytes object that represents the formatted metrics and the second item is a dict of header fields that can be added to a HTTP response.