diff --git a/opentelemetry/proto/metrics/v1/metrics.proto b/opentelemetry/proto/metrics/v1/metrics.proto index 7c092e8e5..c7604c31e 100644 --- a/opentelemetry/proto/metrics/v1/metrics.proto +++ b/opentelemetry/proto/metrics/v1/metrics.proto @@ -155,25 +155,55 @@ message MetricDescriptor { repeated string label_keys = 5; } +// LabelValues is a list of label string values. +message LabelValues { + // Values of labels. Each element in this array is the value of the key defined at the + // corresponding index of MetricDescriptor.label_keys array. The number of elements + // in these 2 arrays must be the same. Note that values array must include empty + // strings and must also contain an empty string value for labels for which the + // value was originally unspecified. + repeated string values = 1; + + // Some metric sources allow setting the value of a label to be equal not just to + // empty string but to an unspecified value, or in other words the value of a particular + // label defined in label_keys array may be missing in a particular timeseries. + // In order to support this concept and because ProtoBuf cannot distinguish empty string + // from unspecified string we store indexes of unspecified labels in "values" array in + // this field. This field contains only indexes of unspecified labels. + // This field should not contain duplicate numbers, numbers less than zero or + // numbers greater than or equal to the length of values array. + repeated int32 unspecified_value_indexes = 2; + + // For example: + // label_keys = {"a", "b", "c", "d", "e"} + // values = {"value1", "another value", "", "", "yet another string"} + // unspecified_value_indexes = {2} + // Because unspecified_value_indexes field contains value 2 it means that the empty + // string at index 3 of values array must be interpreted as unspecified value and + // not as an empty string, which means label "c" has no value. As opposed to that + // empty value at index 3 is treated as normal empty string so label "d" has + // value of empty string. +} + // Int64TimeSeries is a list of data points that describes the time-varying values // of a int64 metric. message Int64TimeSeries { // The set of label values that uniquely identify this timeseries. Applies to // all points. The order of label values must match that of label keys in the // metric descriptor. - repeated LabelValue label_values = 1; + LabelValues label_values = 1; // The data points of this timeseries. repeated Int64Value points = 2; } -// eDoubleTimeSeries is a list of data points that describes the time-varying values +// DoubleTimeSeries is a list of data points that describes the time-varying values // of a double metric. message DoubleTimeSeries { // The set of label values that uniquely identify this timeseries. Applies to // all points. The order of label values must match that of label keys in the // metric descriptor. - repeated LabelValue label_values = 1; + LabelValues label_values = 1; // The data points of this timeseries. repeated DoubleValue points = 2; @@ -185,7 +215,7 @@ message HistogramTimeSeries { // The set of label values that uniquely identify this timeseries. Applies to // all points. The order of label values must match that of label keys in the // metric descriptor. - repeated LabelValue label_values = 1; + LabelValues label_values = 1; // The data points of this timeseries. repeated HistogramValue points = 2; @@ -228,21 +258,12 @@ message SummaryTimeSeries { // The set of label values that uniquely identify this timeseries. Applies to // all points. The order of label values must match that of label keys in the // metric descriptor. - repeated LabelValue label_values = 1; + LabelValues label_values = 1; // The data points of this timeseries. repeated SummaryValue points = 2; } -// Label value or indication that the value is missing -message LabelValue { - // The value for the label. - string value = 1; - // If false the value field is ignored and considered not set. - // This is used to differentiate a missing label from an empty string. - bool has_value = 2; -} - // Int64Value is a timestamped measurement of int64 value. message Int64Value { // start_time_unixnano is the time when the cumulative value was reset to zero.