|
| 1 | +// Copyright 2025 The Prometheus Authors |
| 2 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +// you may not use this file except in compliance with the License. |
| 4 | +// You may obtain a copy of the License at |
| 5 | +// |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | +package otlptranslator |
| 14 | + |
| 15 | +const ( |
| 16 | + // MetricMetadataTypeKey is the key used to store the original Prometheus |
| 17 | + // type in metric metadata: |
| 18 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#metric-metadata |
| 19 | + MetricMetadataTypeKey = "prometheus.type" |
| 20 | + // ExemplarTraceIDKey is the key used to store the trace ID in Prometheus |
| 21 | + // exemplars: |
| 22 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#exemplars |
| 23 | + ExemplarTraceIDKey = "trace_id" |
| 24 | + // ExemplarSpanIDKey is the key used to store the Span ID in Prometheus |
| 25 | + // exemplars: |
| 26 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#exemplars |
| 27 | + ExemplarSpanIDKey = "span_id" |
| 28 | + // ScopeInfoMetricName is the name of the metric used to preserve scope |
| 29 | + // attributes in Prometheus format: |
| 30 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope |
| 31 | + ScopeInfoMetricName = "otel_scope_info" |
| 32 | + // ScopeNameLabelKey is the name of the label key used to identify the name |
| 33 | + // of the OpenTelemetry scope which produced the metric: |
| 34 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope |
| 35 | + ScopeNameLabelKey = "otel_scope_name" |
| 36 | + // ScopeVersionLabelKey is the name of the label key used to identify the |
| 37 | + // version of the OpenTelemetry scope which produced the metric: |
| 38 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope |
| 39 | + ScopeVersionLabelKey = "otel_scope_version" |
| 40 | + // TargetInfoMetricName is the name of the metric used to preserve resource |
| 41 | + // attributes in Prometheus format: |
| 42 | + // https://github.com/open-telemetry/opentelemetry-specification/blob/e6eccba97ebaffbbfad6d4358408a2cead0ec2df/specification/compatibility/prometheus_and_openmetrics.md#resource-attributes-1 |
| 43 | + // It originates from OpenMetrics: |
| 44 | + // https://github.com/OpenObservability/OpenMetrics/blob/1386544931307dff279688f332890c31b6c5de36/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems |
| 45 | + TargetInfoMetricName = "target_info" |
| 46 | +) |
| 47 | + |
| 48 | +type MetricType string |
| 49 | + |
| 50 | +const ( |
| 51 | + MetricTypeNonMonotonicCounter MetricType = "non-monotonic-counter" |
| 52 | + MetricTypeMonotonicCounter MetricType = "monotonic-counter" |
| 53 | + MetricTypeGauge MetricType = "gauge" |
| 54 | + MetricTypeHistogram MetricType = "histogram" |
| 55 | + MetricTypeExponentialHistogram MetricType = "exponential-histogram" |
| 56 | + MetricTypeSummary MetricType = "summary" |
| 57 | + MetricTypeUnknown MetricType = "unknown" |
| 58 | +) |
0 commit comments