aioprometheus.formats.text module¶
This module implements a Prometheus metrics text formatter
- class aioprometheus.formats.text.TextFormatter(timestamp: bool = False)¶
Bases:
aioprometheus.formats.base.IFormatter
This formatter encodes into the Text format.
The histogram and summary types are difficult to represent in the text format. The following conventions apply:
The sample sum for a summary or histogram named x is given as a separate sample named x_sum.
The sample count for a summary or histogram named x is given as a separate sample named x_count.
Each quantile of a summary named x is given as a separate sample line with the same name x and a label {quantile=”y”}.
Each bucket count of a histogram named x is given as a separate sample line with the name x_bucket and a label {le=”y”} (where y is the upper bound of the bucket).
A histogram must have a bucket with {le=”+Inf”}. Its value must be identical to the value of x_count.
The buckets of a histogram and the quantiles of a summary must appear in increasing numerical order of their label values (for the le or the quantile label, respectively).
- get_headers() Dict[str, str] ¶
Returns a dict of HTTP headers for this response format
- marshall(registry: aioprometheus.collectors.Registry) bytes ¶
Marshalls a registry (containing collectors) into a bytes object
- marshall_collector(collector: aioprometheus.collectors.Collector) str ¶
Marshalls a collector into a string containing one or more lines
- marshall_lines(collector: aioprometheus.collectors.Collector) List[str] ¶
Marshalls a collector into a sequence of strings representing the metrics in the collector.
- Returns
a list of strings.