diff --git a/opentelemetry/proto/metrics/v1/metrics.proto b/opentelemetry/proto/metrics/v1/metrics.proto index dee50d25e..a1f56e170 100644 --- a/opentelemetry/proto/metrics/v1/metrics.proto +++ b/opentelemetry/proto/metrics/v1/metrics.proto @@ -201,6 +201,15 @@ message Metric { // "StartTimeUnixNano" is ignored for all data points. message Gauge { repeated NumberDataPoint data_points = 1; + + // type provides additional type information for gauges. + // + // When receiving from older producers of OTLP, it is safe to assume the + // zero-value for type, GAUGE_TYPE_STANDARD. When sending OTLP to older + // consumers, it is safe for them to ignore the field. In both cases, the + // previous behavior without type is maintained until producer and + // consumer are aware of the field. + GaugeType type = 2; } // Sum represents the type of a scalar metric that is calculated as a sum of all @@ -337,6 +346,24 @@ enum DataPointFlags { // Bits 2-31 are reserved for future use. } +// GaugeType defines valid gauge "sub-types", which are used to describe +// gauges which have additional properties. These types generally apply +// to metrics which originate from protocols which support these additional +// types, but are represented as gauges in OTLP. +enum GaugeType { + // GAUGE_TYPE_STANDARD is the default GaugeType, which represents a standard + // gauge. Since the OpenTelemetry API enforces types, this type is used for + // all metrics from OpenTelemetry instrumentation. + GAUGE_TYPE_STANDARD = 0; + + // GAUGE_TYPE_UNKNOWN is a GaugeType which represents a metric for which the + // real type is not known, but is treated as a Gauge, such as a Prometheus + // metric without a TYPE comment. For example, the metric may be a + // monotonically-increasing sum, or histogram, but type information was not + // included at the source. + GAUGE_TYPE_UNKNOWN = 1; +} + // NumberDataPoint is a single data point in a timeseries that describes the // time-varying scalar value of a metric. message NumberDataPoint {