Class PrometheusExportUtils
- java.lang.Object
-
- io.opencensus.exporter.stats.prometheus.PrometheusExportUtils
-
final class PrometheusExportUtils extends java.lang.ObjectUtil methods to convert OpenCensus Metrics data models to Prometheus data models.Each OpenCensus
MetricDescriptorwill be converted to a PrometheusCollector.MetricFamilySampleswith noCollector.MetricFamilySamples.Samples, and is used for registering PrometheusMetrics.Each OpenCensus
Metricwill be converted to a PrometheusCollector.MetricFamilySamples, and eachPointof theMetricwill be converted to PrometheusCollector.MetricFamilySamples.Samples.io.opencensus.metrics.export.Value.ValueDouble,io.opencensus.metrics.export.Value.ValueLongwill be converted to a singleCollector.MetricFamilySamples.Sample.io.opencensus.metrics.export.Value.ValueSummarywill be converted to twoSamples sum and count.io.opencensus.metrics.export.Value.ValueDistributionwill be converted to a list ofCollector.MetricFamilySamples.Samples that have the sum, count and histogram buckets.LabelKeyandLabelValuewill be converted to PrometheusLabelNameandLabelValue.NullLabelValuewill 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 Modifier and Type Field Description (package private) static java.lang.StringLABEL_NAME_BUCKET_BOUND(package private) static java.lang.StringLABEL_NAME_QUANTILE(package private) static java.lang.StringSAMPLE_SUFFIX_BUCKET(package private) static java.lang.StringSAMPLE_SUFFIX_COUNT(package private) static java.lang.StringSAMPLE_SUFFIX_SUM
-
Constructor Summary
Constructors Modifier Constructor Description privatePrometheusExportUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static booleancontainsDisallowedLeLabelForHistogram(java.util.List<java.lang.String> labelNames, io.prometheus.client.Collector.Type type)(package private) static booleancontainsDisallowedQuantileLabelForSummary(java.util.List<java.lang.String> labelNames, io.prometheus.client.Collector.Type type)(package private) static java.util.List<java.lang.String>convertToLabelNames(java.util.List<LabelKey> labelKeys)(package private) static io.prometheus.client.Collector.MetricFamilySamplescreateDescribableMetricFamilySamples(MetricDescriptor metricDescriptor, java.lang.String namespace)(package private) static io.prometheus.client.Collector.MetricFamilySamplescreateMetricFamilySamples(Metric metric, java.lang.String namespace)private static java.lang.StringgetNamespacedName(java.lang.String metricName, java.lang.String namespace)(package private) static java.util.List<io.prometheus.client.Collector.MetricFamilySamples.Sample>getSamples(java.lang.String name, java.util.List<java.lang.String> labelNames, java.util.List<LabelValue> labelValuesList, Value value)(package private) static io.prometheus.client.Collector.TypegetType(MetricDescriptor.Type type)
-
-
-
Field Detail
-
SAMPLE_SUFFIX_BUCKET
static final java.lang.String SAMPLE_SUFFIX_BUCKET
- See Also:
- Constant Field Values
-
SAMPLE_SUFFIX_COUNT
static final java.lang.String SAMPLE_SUFFIX_COUNT
- See Also:
- Constant Field Values
-
SAMPLE_SUFFIX_SUM
static final java.lang.String SAMPLE_SUFFIX_SUM
- See Also:
- Constant Field Values
-
LABEL_NAME_BUCKET_BOUND
static final java.lang.String LABEL_NAME_BUCKET_BOUND
- See Also:
- Constant Field Values
-
LABEL_NAME_QUANTILE
static final java.lang.String LABEL_NAME_QUANTILE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createMetricFamilySamples
static io.prometheus.client.Collector.MetricFamilySamples createMetricFamilySamples(Metric metric, java.lang.String namespace)
-
createDescribableMetricFamilySamples
static io.prometheus.client.Collector.MetricFamilySamples createDescribableMetricFamilySamples(MetricDescriptor metricDescriptor, java.lang.String namespace)
-
getNamespacedName
private static java.lang.String getNamespacedName(java.lang.String metricName, java.lang.String namespace)
-
getType
static io.prometheus.client.Collector.Type getType(MetricDescriptor.Type type)
-
getSamples
static java.util.List<io.prometheus.client.Collector.MetricFamilySamples.Sample> getSamples(java.lang.String name, java.util.List<java.lang.String> labelNames, java.util.List<LabelValue> labelValuesList, Value value)
-
convertToLabelNames
static java.util.List<java.lang.String> convertToLabelNames(java.util.List<LabelKey> labelKeys)
-
containsDisallowedLeLabelForHistogram
static boolean containsDisallowedLeLabelForHistogram(java.util.List<java.lang.String> labelNames, io.prometheus.client.Collector.Type type)
-
containsDisallowedQuantileLabelForSummary
static boolean containsDisallowedQuantileLabelForSummary(java.util.List<java.lang.String> labelNames, io.prometheus.client.Collector.Type type)
-
-