Class PrometheusExportUtils
Each OpenCensus MetricDescriptor
will be converted to a Prometheus Collector.MetricFamilySamples
with no Collector.MetricFamilySamples.Sample
s, and is used for registering Prometheus
Metric
s.
Each OpenCensus Metric
will be converted to a Prometheus Collector.MetricFamilySamples
,
and each Point
of the Metric
will be converted to Prometheus Collector.MetricFamilySamples.Sample
s.
io.opencensus.metrics.export.Value.ValueDouble
,
io.opencensus.metrics.export.Value.ValueLong
will be converted to a single Collector.MetricFamilySamples.Sample
.
io.opencensus.metrics.export.Value.ValueSummary
will be converted to two Sample
s
sum and count. io.opencensus.metrics.export.Value.ValueDistribution
will be converted to
a list of Collector.MetricFamilySamples.Sample
s that have the sum, count and histogram buckets.
LabelKey
and LabelValue
will be converted to Prometheus LabelName
and
LabelValue
. Null
LabelValue
will be converted to an empty string.
Please note that Prometheus Metric and Label name can only have alphanumeric characters and underscore. All other characters will be sanitized by underscores.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
containsDisallowedLeLabelForHistogram
(List<String> labelNames, io.prometheus.client.Collector.Type type) (package private) static boolean
containsDisallowedQuantileLabelForSummary
(List<String> labelNames, io.prometheus.client.Collector.Type type) convertToLabelNames
(List<LabelKey> labelKeys) (package private) static io.prometheus.client.Collector.MetricFamilySamples
createDescribableMetricFamilySamples
(MetricDescriptor metricDescriptor, String namespace) (package private) static io.prometheus.client.Collector.MetricFamilySamples
createMetricFamilySamples
(Metric metric, String namespace) private static String
getNamespacedName
(String metricName, String namespace) (package private) static List
<io.prometheus.client.Collector.MetricFamilySamples.Sample> getSamples
(String name, List<String> labelNames, List<LabelValue> labelValuesList, Value value) (package private) static io.prometheus.client.Collector.Type
getType
(MetricDescriptor.Type type)
-
Field Details
-
SAMPLE_SUFFIX_BUCKET
- See Also:
-
SAMPLE_SUFFIX_COUNT
- See Also:
-
SAMPLE_SUFFIX_SUM
- See Also:
-
LABEL_NAME_BUCKET_BOUND
- See Also:
-
LABEL_NAME_QUANTILE
- See Also:
-
-
Constructor Details
-
PrometheusExportUtils
private PrometheusExportUtils()
-
-
Method Details
-
createMetricFamilySamples
-
createDescribableMetricFamilySamples
static io.prometheus.client.Collector.MetricFamilySamples createDescribableMetricFamilySamples(MetricDescriptor metricDescriptor, String namespace) -
getNamespacedName
-
getType
-
getSamples
-
convertToLabelNames
-
containsDisallowedLeLabelForHistogram
-
containsDisallowedQuantileLabelForSummary
-