@opentelemetry/otlp-grpc-exporter-base 0.28.0 → 0.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,29 +22,108 @@ import "opentelemetry/proto/resource/v1/resource.proto";
22
22
  option java_multiple_files = true;
23
23
  option java_package = "io.opentelemetry.proto.metrics.v1";
24
24
  option java_outer_classname = "MetricsProto";
25
- option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1";
25
+ option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1";
26
26
 
27
- // A collection of InstrumentationLibraryMetrics from a Resource.
27
+ // MetricsData represents the metrics data that can be stored in a persistent
28
+ // storage, OR can be embedded by other protocols that transfer OTLP metrics
29
+ // data but do not implement the OTLP protocol.
30
+ //
31
+ // The main difference between this message and collector protocol is that
32
+ // in this message there will not be any "control" or "metadata" specific to
33
+ // OTLP protocol.
34
+ //
35
+ // When new fields are added into this message, the OTLP request MUST be updated
36
+ // as well.
37
+ message MetricsData {
38
+ // An array of ResourceMetrics.
39
+ // For data coming from a single resource this array will typically contain
40
+ // one element. Intermediary nodes that receive data from multiple origins
41
+ // typically batch the data before forwarding further and in that case this
42
+ // array will contain multiple elements.
43
+ repeated ResourceMetrics resource_metrics = 1;
44
+ }
45
+
46
+ // A collection of ScopeMetrics from a Resource.
28
47
  message ResourceMetrics {
29
48
  // The resource for the metrics in this message.
30
49
  // If this field is not set then no resource info is known.
31
50
  opentelemetry.proto.resource.v1.Resource resource = 1;
32
51
 
33
52
  // A list of metrics that originate from a resource.
34
- repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 2;
53
+ repeated ScopeMetrics scope_metrics = 2;
54
+
55
+ // A list of InstrumentationLibraryMetrics that originate from a resource.
56
+ // This field is deprecated and will be removed after grace period expires on June 15, 2022.
57
+ //
58
+ // During the grace period the following rules SHOULD be followed:
59
+ //
60
+ // For Binary Protobufs
61
+ // ====================
62
+ // Binary Protobuf senders SHOULD NOT set instrumentation_library_metrics. Instead
63
+ // scope_metrics SHOULD be set.
64
+ //
65
+ // Binary Protobuf receivers SHOULD check if instrumentation_library_metrics is set
66
+ // and scope_metrics is not set then the value in instrumentation_library_metrics
67
+ // SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics.
68
+ // If scope_metrics is set then instrumentation_library_metrics SHOULD be ignored.
69
+ //
70
+ // For JSON
71
+ // ========
72
+ // JSON senders that set instrumentation_library_metrics field MAY also set
73
+ // scope_metrics to carry the same metrics, essentially double-publishing the same data.
74
+ // Such double-publishing MAY be controlled by a user-settable option.
75
+ // If double-publishing is not used then the senders SHOULD set scope_metrics and
76
+ // SHOULD NOT set instrumentation_library_metrics.
77
+ //
78
+ // JSON receivers SHOULD check if instrumentation_library_metrics is set and
79
+ // scope_metrics is not set then the value in instrumentation_library_metrics
80
+ // SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics.
81
+ // If scope_metrics is set then instrumentation_library_metrics field SHOULD be ignored.
82
+ repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 1000 [deprecated = true];
83
+
84
+ // This schema_url applies to the data in the "resource" field. It does not apply
85
+ // to the data in the "scope_metrics" field which have their own schema_url field.
86
+ string schema_url = 3;
87
+ }
88
+
89
+ // A collection of Metrics produced by an Scope.
90
+ message ScopeMetrics {
91
+ // The instrumentation scope information for the metrics in this message.
92
+ // Semantically when InstrumentationScope isn't set, it is equivalent with
93
+ // an empty instrumentation scope name (unknown).
94
+ opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
95
+
96
+ // A list of metrics that originate from an instrumentation library.
97
+ repeated Metric metrics = 2;
98
+
99
+ // This schema_url applies to all metrics in the "metrics" field.
100
+ string schema_url = 3;
35
101
  }
36
102
 
37
103
  // A collection of Metrics produced by an InstrumentationLibrary.
104
+ // InstrumentationLibraryMetrics is wire-compatible with ScopeMetrics for binary
105
+ // Protobuf format.
106
+ // This message is deprecated and will be removed on June 15, 2022.
38
107
  message InstrumentationLibraryMetrics {
108
+ option deprecated = true;
109
+
39
110
  // The instrumentation library information for the metrics in this message.
40
- // If this field is not set then no library info is known.
111
+ // Semantically when InstrumentationLibrary isn't set, it is equivalent with
112
+ // an empty instrumentation library name (unknown).
41
113
  opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1;
42
114
 
43
115
  // A list of metrics that originate from an instrumentation library.
44
116
  repeated Metric metrics = 2;
117
+
118
+ // This schema_url applies to all metrics in the "metrics" field.
119
+ string schema_url = 3;
45
120
  }
46
121
 
47
- // Defines a Metric which has one or more timeseries.
122
+ // Defines a Metric which has one or more timeseries. The following is a
123
+ // brief summary of the Metric data model. For more details, see:
124
+ //
125
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md
126
+ //
48
127
  //
49
128
  // The data model and relation between entities is shown in the
50
129
  // diagram below. Here, "DataPoint" is the term used to refer to any
@@ -53,19 +132,19 @@ message InstrumentationLibraryMetrics {
53
132
  //
54
133
  // - Metric is composed of a metadata and data.
55
134
  // - Metadata part contains a name, description, unit.
56
- // - Data is one of the possible types (Gauge, Sum, Histogram, etc.).
57
- // - DataPoint contains timestamps, labels, and one of the possible value type
135
+ // - Data is one of the possible types (Sum, Gauge, Histogram, Summary).
136
+ // - DataPoint contains timestamps, attributes, and one of the possible value type
58
137
  // fields.
59
138
  //
60
139
  // Metric
61
140
  // +------------+
62
141
  // |name |
63
142
  // |description |
64
- // |unit | +---------------------------+
65
- // |data |---> |Gauge, Sum, Histogram, ... |
66
- // +------------+ +---------------------------+
143
+ // |unit | +------------------------------------+
144
+ // |data |---> |Gauge, Sum, Histogram, Summary, ... |
145
+ // +------------+ +------------------------------------+
67
146
  //
68
- // Data [One of Gauge, Sum, Histogram, ...]
147
+ // Data [One of Gauge, Sum, Histogram, Summary, ...]
69
148
  // +-----------+
70
149
  // |... | // Metadata about the Data.
71
150
  // |points |--+
@@ -94,15 +173,40 @@ message InstrumentationLibraryMetrics {
94
173
  // |+-----+ |
95
174
  // +---------------------------+
96
175
  //
176
+ // Each distinct type of DataPoint represents the output of a specific
177
+ // aggregation function, the result of applying the DataPoint's
178
+ // associated function of to one or more measurements.
179
+ //
97
180
  // All DataPoint types have three common fields:
98
- // - Labels zero or more key-value pairs associated with the data point.
99
- // - StartTimeUnixNano MUST be set to the start of the interval when the data's
100
- // type includes an AggregationTemporality. This field is not set otherwise.
101
- // - TimeUnixNano MUST be set to:
102
- // - the moment when an aggregation is reported (independent of the
103
- // aggregation temporality).
104
- // - the instantaneous time of the event.
181
+ // - Attributes includes key-value pairs associated with the data point
182
+ // - TimeUnixNano is required, set to the end time of the aggregation
183
+ // - StartTimeUnixNano is optional, but strongly encouraged for DataPoints
184
+ // having an AggregationTemporality field, as discussed below.
185
+ //
186
+ // Both TimeUnixNano and StartTimeUnixNano values are expressed as
187
+ // UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
188
+ //
189
+ // # TimeUnixNano
190
+ //
191
+ // This field is required, having consistent interpretation across
192
+ // DataPoint types. TimeUnixNano is the moment corresponding to when
193
+ // the data point's aggregate value was captured.
194
+ //
195
+ // Data points with the 0 value for TimeUnixNano SHOULD be rejected
196
+ // by consumers.
197
+ //
198
+ // # StartTimeUnixNano
199
+ //
200
+ // StartTimeUnixNano in general allows detecting when a sequence of
201
+ // observations is unbroken. This field indicates to consumers the
202
+ // start time for points with cumulative and delta
203
+ // AggregationTemporality, and it should be included whenever possible
204
+ // to support correct rate calculation. Although it may be omitted
205
+ // when the start time is truly unknown, setting StartTimeUnixNano is
206
+ // strongly encouraged.
105
207
  message Metric {
208
+ reserved 4, 6, 8;
209
+
106
210
  // name of the metric, including its DNS name prefix. It must be unique.
107
211
  string name = 1;
108
212
 
@@ -113,68 +217,35 @@ message Metric {
113
217
  // described by http://unitsofmeasure.org/ucum.html.
114
218
  string unit = 3;
115
219
 
116
- // TODO: Decide if support for RawMeasurements (measurements recorded using
117
- // the synchronous instruments) is necessary. It can be used to delegate the
118
- // aggregation from the application to the agent/collector. See
119
- // https://github.com/open-telemetry/opentelemetry-specification/issues/617
120
-
121
220
  // Data determines the aggregation type (if any) of the metric, what is the
122
221
  // reported value type for the data points, as well as the relatationship to
123
222
  // the time interval over which they are reported.
124
- //
125
- // TODO: Update table after the decision on:
126
- // https://github.com/open-telemetry/opentelemetry-specification/issues/731.
127
- // By default, metrics recording using the OpenTelemetry API are exported as
128
- // (the table does not include MeasurementValueType to avoid extra rows):
129
- //
130
- // Instrument Type
131
- // ----------------------------------------------
132
- // Counter Sum(aggregation_temporality=delta;is_monotonic=true)
133
- // UpDownCounter Sum(aggregation_temporality=delta;is_monotonic=false)
134
- // ValueRecorder TBD
135
- // SumObserver Sum(aggregation_temporality=cumulative;is_monotonic=true)
136
- // UpDownSumObserver Sum(aggregation_temporality=cumulative;is_monotonic=false)
137
- // ValueObserver Gauge()
138
223
  oneof data {
139
- IntGauge int_gauge = 4;
140
- DoubleGauge double_gauge = 5;
141
- IntSum int_sum = 6;
142
- DoubleSum double_sum = 7;
143
- IntHistogram int_histogram = 8;
144
- DoubleHistogram double_histogram = 9;
224
+ Gauge gauge = 5;
225
+ Sum sum = 7;
226
+ Histogram histogram = 9;
227
+ ExponentialHistogram exponential_histogram = 10;
228
+ Summary summary = 11;
145
229
  }
146
230
  }
147
231
 
148
- // Gauge represents the type of a int scalar metric that always exports the
149
- // "current value" for every data point. It should be used for an "unknown"
150
- // aggregation.
151
- //
152
- // A Gauge does not support different aggregation temporalities. Given the
153
- // aggregation is unknown, points cannot be combined using the same
154
- // aggregation, regardless of aggregation temporalities. Therefore,
155
- // AggregationTemporality is not included. Consequently, this also means
156
- // "StartTimeUnixNano" is ignored for all data points.
157
- message IntGauge {
158
- repeated IntDataPoint data_points = 1;
159
- }
160
-
161
- // Gauge represents the type of a double scalar metric that always exports the
232
+ // Gauge represents the type of a scalar metric that always exports the
162
233
  // "current value" for every data point. It should be used for an "unknown"
163
234
  // aggregation.
164
- //
235
+ //
165
236
  // A Gauge does not support different aggregation temporalities. Given the
166
237
  // aggregation is unknown, points cannot be combined using the same
167
238
  // aggregation, regardless of aggregation temporalities. Therefore,
168
239
  // AggregationTemporality is not included. Consequently, this also means
169
240
  // "StartTimeUnixNano" is ignored for all data points.
170
- message DoubleGauge {
171
- repeated DoubleDataPoint data_points = 1;
241
+ message Gauge {
242
+ repeated NumberDataPoint data_points = 1;
172
243
  }
173
244
 
174
- // Sum represents the type of a numeric int scalar metric that is calculated as
175
- // a sum of all reported measurements over a time interval.
176
- message IntSum {
177
- repeated IntDataPoint data_points = 1;
245
+ // Sum represents the type of a scalar metric that is calculated as a sum of all
246
+ // reported measurements over a time interval.
247
+ message Sum {
248
+ repeated NumberDataPoint data_points = 1;
178
249
 
179
250
  // aggregation_temporality describes if the aggregator reports delta changes
180
251
  // since last report time, or cumulative changes since a fixed start time.
@@ -184,37 +255,34 @@ message IntSum {
184
255
  bool is_monotonic = 3;
185
256
  }
186
257
 
187
- // Sum represents the type of a numeric double scalar metric that is calculated
188
- // as a sum of all reported measurements over a time interval.
189
- message DoubleSum {
190
- repeated DoubleDataPoint data_points = 1;
191
-
258
+ // Histogram represents the type of a metric that is calculated by aggregating
259
+ // as a Histogram of all reported measurements over a time interval.
260
+ message Histogram {
261
+ repeated HistogramDataPoint data_points = 1;
262
+
192
263
  // aggregation_temporality describes if the aggregator reports delta changes
193
264
  // since last report time, or cumulative changes since a fixed start time.
194
265
  AggregationTemporality aggregation_temporality = 2;
195
-
196
- // If "true" means that the sum is monotonic.
197
- bool is_monotonic = 3;
198
266
  }
199
267
 
200
- // Represents the type of a metric that is calculated by aggregating as a
201
- // Histogram of all reported int measurements over a time interval.
202
- message IntHistogram {
203
- repeated IntHistogramDataPoint data_points = 1;
268
+ // ExponentialHistogram represents the type of a metric that is calculated by aggregating
269
+ // as a ExponentialHistogram of all reported double measurements over a time interval.
270
+ message ExponentialHistogram {
271
+ repeated ExponentialHistogramDataPoint data_points = 1;
204
272
 
205
273
  // aggregation_temporality describes if the aggregator reports delta changes
206
274
  // since last report time, or cumulative changes since a fixed start time.
207
275
  AggregationTemporality aggregation_temporality = 2;
208
276
  }
209
277
 
210
- // Represents the type of a metric that is calculated by aggregating as a
211
- // Histogram of all reported double measurements over a time interval.
212
- message DoubleHistogram {
213
- repeated DoubleHistogramDataPoint data_points = 1;
214
-
215
- // aggregation_temporality describes if the aggregator reports delta changes
216
- // since last report time, or cumulative changes since a fixed start time.
217
- AggregationTemporality aggregation_temporality = 2;
278
+ // Summary metric data are used to convey quantile summaries,
279
+ // a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
280
+ // and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45)
281
+ // data type. These data points cannot always be merged in a meaningful way.
282
+ // While they can be useful in some applications, histogram data points are
283
+ // recommended for new applications.
284
+ message Summary {
285
+ repeated SummaryDataPoint data_points = 1;
218
286
  }
219
287
 
220
288
  // AggregationTemporality defines how a metric aggregator reports aggregated
@@ -250,7 +318,7 @@ enum AggregationTemporality {
250
318
  // t_0+2 with a value of 2.
251
319
  AGGREGATION_TEMPORALITY_DELTA = 1;
252
320
 
253
- // CUMULATIVE is an AggregationTemporality for a metic aggregator which
321
+ // CUMULATIVE is an AggregationTemporality for a metric aggregator which
254
322
  // reports changes since a fixed start time. This means that current values
255
323
  // of a CUMULATIVE metric depend on all previous measurements since the
256
324
  // start time. Because of this, the sender is required to retain this state
@@ -281,105 +349,99 @@ enum AggregationTemporality {
281
349
  // number of requests received over the interval of time t_1 to
282
350
  // t_0+1 with a value of 1.
283
351
  //
284
- // Note: Even though, when reporting changes since last report time, using
352
+ // Note: Even though, when reporting changes since last report time, using
285
353
  // CUMULATIVE is valid, it is not recommended. This may cause problems for
286
354
  // systems that do not use start_time to determine when the aggregation
287
355
  // value was reset (e.g. Prometheus).
288
356
  AGGREGATION_TEMPORALITY_CUMULATIVE = 2;
289
357
  }
290
358
 
291
- // IntDataPoint is a single data point in a timeseries that describes the
292
- // time-varying values of a int64 metric.
293
- message IntDataPoint {
294
- // The set of labels that uniquely identify this timeseries.
295
- repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
296
-
297
- // start_time_unix_nano is the last time when the aggregation value was reset
298
- // to "zero". For some metric types this is ignored, see data types for more
299
- // details.
300
- //
301
- // The aggregation value is over the time interval (start_time_unix_nano,
302
- // time_unix_nano].
303
- //
304
- // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
305
- // 1970.
306
- //
307
- // Value of 0 indicates that the timestamp is unspecified. In that case the
308
- // timestamp may be decided by the backend.
309
- fixed64 start_time_unix_nano = 2;
310
-
311
- // time_unix_nano is the moment when this aggregation value was reported.
312
- //
313
- // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
314
- // 1970.
315
- fixed64 time_unix_nano = 3;
359
+ // DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a
360
+ // bit-field representing 32 distinct boolean flags. Each flag defined in this
361
+ // enum is a bit-mask. To test the presence of a single flag in the flags of
362
+ // a data point, for example, use an expression like:
363
+ //
364
+ // (point.flags & FLAG_NO_RECORDED_VALUE) == FLAG_NO_RECORDED_VALUE
365
+ //
366
+ enum DataPointFlags {
367
+ FLAG_NONE = 0;
316
368
 
317
- // value itself.
318
- sfixed64 value = 4;
369
+ // This DataPoint is valid but has no recorded value. This value
370
+ // SHOULD be used to reflect explicitly missing data in a series, as
371
+ // for an equivalent to the Prometheus "staleness marker".
372
+ FLAG_NO_RECORDED_VALUE = 1;
319
373
 
320
- // (Optional) List of exemplars collected from
321
- // measurements that were used to form the data point
322
- repeated IntExemplar exemplars = 5;
374
+ // Bits 2-31 are reserved for future use.
323
375
  }
324
376
 
325
- // DoubleDataPoint is a single data point in a timeseries that describes the
326
- // time-varying value of a double metric.
327
- message DoubleDataPoint {
328
- // The set of labels that uniquely identify this timeseries.
329
- repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
377
+ // NumberDataPoint is a single data point in a timeseries that describes the
378
+ // time-varying scalar value of a metric.
379
+ message NumberDataPoint {
380
+ reserved 1;
381
+
382
+ // The set of key/value pairs that uniquely identify the timeseries from
383
+ // where this point belongs. The list may be empty (may contain 0 elements).
384
+ // Attribute keys MUST be unique (it is not allowed to have more than one
385
+ // attribute with the same key).
386
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
330
387
 
331
- // start_time_unix_nano is the last time when the aggregation value was reset
332
- // to "zero". For some metric types this is ignored, see data types for more
333
- // details.
388
+ // StartTimeUnixNano is optional but strongly encouraged, see the
389
+ // the detailed comments above Metric.
334
390
  //
335
- // The aggregation value is over the time interval (start_time_unix_nano,
336
- // time_unix_nano].
337
- //
338
391
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
339
392
  // 1970.
340
- //
341
- // Value of 0 indicates that the timestamp is unspecified. In that case the
342
- // timestamp may be decided by the backend.
343
393
  fixed64 start_time_unix_nano = 2;
344
394
 
345
- // time_unix_nano is the moment when this aggregation value was reported.
346
- //
395
+ // TimeUnixNano is required, see the detailed comments above Metric.
396
+ //
347
397
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
348
398
  // 1970.
349
399
  fixed64 time_unix_nano = 3;
350
400
 
351
- // value itself.
352
- double value = 4;
401
+ // The value itself. A point is considered invalid when one of the recognized
402
+ // value fields is not present inside this oneof.
403
+ oneof value {
404
+ double as_double = 4;
405
+ sfixed64 as_int = 6;
406
+ }
353
407
 
354
408
  // (Optional) List of exemplars collected from
355
409
  // measurements that were used to form the data point
356
- repeated DoubleExemplar exemplars = 5;
410
+ repeated Exemplar exemplars = 5;
411
+
412
+ // Flags that apply to this specific data point. See DataPointFlags
413
+ // for the available flags and their meaning.
414
+ uint32 flags = 8;
357
415
  }
358
416
 
359
- // IntHistogramDataPoint is a single data point in a timeseries that describes
360
- // the time-varying values of a Histogram of int values. A Histogram contains
361
- // summary statistics for a population of values, it may optionally contain
362
- // the distribution of those values across a set of buckets.
363
- message IntHistogramDataPoint {
364
- // The set of labels that uniquely identify this timeseries.
365
- repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
366
-
367
- // start_time_unix_nano is the last time when the aggregation value was reset
368
- // to "zero". For some metric types this is ignored, see data types for more
369
- // details.
370
- //
371
- // The aggregation value is over the time interval (start_time_unix_nano,
372
- // time_unix_nano].
373
- //
417
+ // HistogramDataPoint is a single data point in a timeseries that describes the
418
+ // time-varying values of a Histogram. A Histogram contains summary statistics
419
+ // for a population of values, it may optionally contain the distribution of
420
+ // those values across a set of buckets.
421
+ //
422
+ // If the histogram contains the distribution of values, then both
423
+ // "explicit_bounds" and "bucket counts" fields must be defined.
424
+ // If the histogram does not contain the distribution of values, then both
425
+ // "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
426
+ // "sum" are known.
427
+ message HistogramDataPoint {
428
+ reserved 1;
429
+
430
+ // The set of key/value pairs that uniquely identify the timeseries from
431
+ // where this point belongs. The list may be empty (may contain 0 elements).
432
+ // Attribute keys MUST be unique (it is not allowed to have more than one
433
+ // attribute with the same key).
434
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
435
+
436
+ // StartTimeUnixNano is optional but strongly encouraged, see the
437
+ // the detailed comments above Metric.
438
+ //
374
439
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
375
440
  // 1970.
376
- //
377
- // Value of 0 indicates that the timestamp is unspecified. In that case the
378
- // timestamp may be decided by the backend.
379
441
  fixed64 start_time_unix_nano = 2;
380
442
 
381
- // time_unix_nano is the moment when this aggregation value was reported.
382
- //
443
+ // TimeUnixNano is required, see the detailed comments above Metric.
444
+ //
383
445
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
384
446
  // 1970.
385
447
  fixed64 time_unix_nano = 3;
@@ -390,9 +452,14 @@ message IntHistogramDataPoint {
390
452
  fixed64 count = 4;
391
453
 
392
454
  // sum of the values in the population. If count is zero then this field
393
- // must be zero. This value must be equal to the sum of the "sum" fields in
394
- // buckets if a histogram is provided.
395
- sfixed64 sum = 5;
455
+ // must be zero.
456
+ //
457
+ // Note: Sum should only be filled out when measuring non-negative discrete
458
+ // events, and is assumed to be monotonic over the values of these events.
459
+ // Negative events *can* be recorded, but sum should not be filled out when
460
+ // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
461
+ // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
462
+ optional double sum = 5;
396
463
 
397
464
  // bucket_counts is an optional field contains the count values of histogram
398
465
  // for each bucket.
@@ -403,150 +470,208 @@ message IntHistogramDataPoint {
403
470
  // the number of elements in explicit_bounds array.
404
471
  repeated fixed64 bucket_counts = 6;
405
472
 
406
- // A histogram may optionally contain the distribution of the values in the population.
407
- // In that case one of the option fields below and "buckets" field both must be defined.
408
- // Otherwise all option fields and "buckets" field must be omitted in which case the
409
- // distribution of values in the histogram is unknown and only the total count and sum are known.
410
-
411
- // explicit_bounds is the only supported bucket option currently.
412
- // TODO: Add more bucket options.
413
-
414
473
  // explicit_bounds specifies buckets with explicitly defined bounds for values.
415
- // The bucket boundaries are described by "bounds" field.
416
474
  //
417
- // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket
418
- // at index i are:
475
+ // The boundaries for bucket at index i are:
476
+ //
477
+ // (-infinity, explicit_bounds[i]] for i == 0
478
+ // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds)
479
+ // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds)
419
480
  //
420
- // (-infinity, bounds[i]) for i == 0
421
- // [bounds[i-1], bounds[i]) for 0 < i < N-1
422
- // [bounds[i], +infinity) for i == N-1
423
- // The values in bounds array must be strictly increasing.
481
+ // The values in the explicit_bounds array must be strictly increasing.
424
482
  //
425
- // Note: only [a, b) intervals are currently supported for each bucket except the first one.
426
- // If we decide to also support (a, b] intervals we should add support for these by defining
427
- // a boolean value which decides what type of intervals to use.
483
+ // Histogram buckets are inclusive of their upper boundary, except the last
484
+ // bucket where the boundary is at infinity. This format is intentionally
485
+ // compatible with the OpenMetrics histogram definition.
428
486
  repeated double explicit_bounds = 7;
429
487
 
430
488
  // (Optional) List of exemplars collected from
431
489
  // measurements that were used to form the data point
432
- repeated IntExemplar exemplars = 8;
490
+ repeated Exemplar exemplars = 8;
491
+
492
+ // Flags that apply to this specific data point. See DataPointFlags
493
+ // for the available flags and their meaning.
494
+ uint32 flags = 10;
433
495
  }
434
496
 
435
- // HistogramDataPoint is a single data point in a timeseries that describes the
436
- // time-varying values of a Histogram of double values. A Histogram contains
497
+ // ExponentialHistogramDataPoint is a single data point in a timeseries that describes the
498
+ // time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains
437
499
  // summary statistics for a population of values, it may optionally contain the
438
500
  // distribution of those values across a set of buckets.
439
- message DoubleHistogramDataPoint {
440
- // The set of labels that uniquely identify this timeseries.
441
- repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
442
-
443
- // start_time_unix_nano is the last time when the aggregation value was reset
444
- // to "zero". For some metric types this is ignored, see data types for more
445
- // details.
501
+ //
502
+ message ExponentialHistogramDataPoint {
503
+ // The set of key/value pairs that uniquely identify the timeseries from
504
+ // where this point belongs. The list may be empty (may contain 0 elements).
505
+ // Attribute keys MUST be unique (it is not allowed to have more than one
506
+ // attribute with the same key).
507
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
508
+
509
+ // StartTimeUnixNano is optional but strongly encouraged, see the
510
+ // the detailed comments above Metric.
446
511
  //
447
- // The aggregation value is over the time interval (start_time_unix_nano,
448
- // time_unix_nano].
449
- //
450
512
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
451
513
  // 1970.
452
- //
453
- // Value of 0 indicates that the timestamp is unspecified. In that case the
454
- // timestamp may be decided by the backend.
455
514
  fixed64 start_time_unix_nano = 2;
456
515
 
457
- // time_unix_nano is the moment when this aggregation value was reported.
458
- //
516
+ // TimeUnixNano is required, see the detailed comments above Metric.
517
+ //
459
518
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
460
519
  // 1970.
461
520
  fixed64 time_unix_nano = 3;
462
521
 
463
- // count is the number of values in the population. Must be non-negative. This
464
- // value must be equal to the sum of the "count" fields in buckets if a
465
- // histogram is provided.
522
+ // count is the number of values in the population. Must be
523
+ // non-negative. This value must be equal to the sum of the "bucket_counts"
524
+ // values in the positive and negative Buckets plus the "zero_count" field.
466
525
  fixed64 count = 4;
467
526
 
468
527
  // sum of the values in the population. If count is zero then this field
469
- // must be zero. This value must be equal to the sum of the "sum" fields in
470
- // buckets if a histogram is provided.
528
+ // must be zero.
529
+ //
530
+ // Note: Sum should only be filled out when measuring non-negative discrete
531
+ // events, and is assumed to be monotonic over the values of these events.
532
+ // Negative events *can* be recorded, but sum should not be filled out when
533
+ // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
534
+ // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
471
535
  double sum = 5;
472
-
473
- // bucket_counts is an optional field contains the count values of histogram
474
- // for each bucket.
536
+
537
+ // scale describes the resolution of the histogram. Boundaries are
538
+ // located at powers of the base, where:
475
539
  //
476
- // The sum of the bucket_counts must equal the value in the count field.
540
+ // base = (2^(2^-scale))
477
541
  //
478
- // The number of elements in bucket_counts array must be by one greater than
479
- // the number of elements in explicit_bounds array.
480
- repeated fixed64 bucket_counts = 6;
481
-
482
- // A histogram may optionally contain the distribution of the values in the population.
483
- // In that case one of the option fields below and "buckets" field both must be defined.
484
- // Otherwise all option fields and "buckets" field must be omitted in which case the
485
- // distribution of values in the histogram is unknown and only the total count and sum are known.
486
-
487
- // explicit_bounds is the only supported bucket option currently.
488
- // TODO: Add more bucket options.
489
-
490
- // explicit_bounds specifies buckets with explicitly defined bounds for values.
491
- // The bucket boundaries are described by "bounds" field.
542
+ // The histogram bucket identified by `index`, a signed integer,
543
+ // contains values that are greater than or equal to (base^index) and
544
+ // less than (base^(index+1)).
492
545
  //
493
- // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket
494
- // at index i are:
546
+ // The positive and negative ranges of the histogram are expressed
547
+ // separately. Negative values are mapped by their absolute value
548
+ // into the negative range using the same scale as the positive range.
495
549
  //
496
- // (-infinity, bounds[i]) for i == 0
497
- // [bounds[i-1], bounds[i]) for 0 < i < N-1
498
- // [bounds[i], +infinity) for i == N-1
499
- // The values in bounds array must be strictly increasing.
550
+ // scale is not restricted by the protocol, as the permissible
551
+ // values depend on the range of the data.
552
+ sint32 scale = 6;
553
+
554
+ // zero_count is the count of values that are either exactly zero or
555
+ // within the region considered zero by the instrumentation at the
556
+ // tolerated degree of precision. This bucket stores values that
557
+ // cannot be expressed using the standard exponential formula as
558
+ // well as values that have been rounded to zero.
500
559
  //
501
- // Note: only [a, b) intervals are currently supported for each bucket except the first one.
502
- // If we decide to also support (a, b] intervals we should add support for these by defining
503
- // a boolean value which decides what type of intervals to use.
504
- repeated double explicit_bounds = 7;
560
+ // Implementations MAY consider the zero bucket to have probability
561
+ // mass equal to (zero_count / count).
562
+ fixed64 zero_count = 7;
563
+
564
+ // positive carries the positive range of exponential bucket counts.
565
+ Buckets positive = 8;
566
+
567
+ // negative carries the negative range of exponential bucket counts.
568
+ Buckets negative = 9;
569
+
570
+ // Buckets are a set of bucket counts, encoded in a contiguous array
571
+ // of counts.
572
+ message Buckets {
573
+ // Offset is the bucket index of the first entry in the bucket_counts array.
574
+ //
575
+ // Note: This uses a varint encoding as a simple form of compression.
576
+ sint32 offset = 1;
577
+
578
+ // Count is an array of counts, where count[i] carries the count
579
+ // of the bucket at index (offset+i). count[i] is the count of
580
+ // values greater than or equal to base^(offset+i) and less than
581
+ // base^(offset+i+1).
582
+ //
583
+ // Note: By contrast, the explicit HistogramDataPoint uses
584
+ // fixed64. This field is expected to have many buckets,
585
+ // especially zeros, so uint64 has been selected to ensure
586
+ // varint encoding.
587
+ repeated uint64 bucket_counts = 2;
588
+ }
589
+
590
+ // Flags that apply to this specific data point. See DataPointFlags
591
+ // for the available flags and their meaning.
592
+ uint32 flags = 10;
505
593
 
506
594
  // (Optional) List of exemplars collected from
507
595
  // measurements that were used to form the data point
508
- repeated DoubleExemplar exemplars = 8;
596
+ repeated Exemplar exemplars = 11;
509
597
  }
510
598
 
511
- // A representation of an exemplar, which is a sample input int measurement.
512
- // Exemplars also hold information about the environment when the measurement
513
- // was recorded, for example the span and trace ID of the active span when the
514
- // exemplar was recorded.
515
- message IntExemplar {
516
- // The set of labels that were filtered out by the aggregator, but recorded
517
- // alongside the original measurement. Only labels that were filtered out
518
- // by the aggregator should be included
519
- repeated opentelemetry.proto.common.v1.StringKeyValue filtered_labels = 1;
599
+ // SummaryDataPoint is a single data point in a timeseries that describes the
600
+ // time-varying values of a Summary metric.
601
+ message SummaryDataPoint {
602
+ reserved 1;
520
603
 
521
- // time_unix_nano is the exact time when this exemplar was recorded
604
+ // The set of key/value pairs that uniquely identify the timeseries from
605
+ // where this point belongs. The list may be empty (may contain 0 elements).
606
+ // Attribute keys MUST be unique (it is not allowed to have more than one
607
+ // attribute with the same key).
608
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
609
+
610
+ // StartTimeUnixNano is optional but strongly encouraged, see the
611
+ // the detailed comments above Metric.
522
612
  //
523
613
  // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
524
614
  // 1970.
525
- fixed64 time_unix_nano = 2;
615
+ fixed64 start_time_unix_nano = 2;
526
616
 
527
- // Numerical int value of the measurement that was recorded.
528
- sfixed64 value = 3;
617
+ // TimeUnixNano is required, see the detailed comments above Metric.
618
+ //
619
+ // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
620
+ // 1970.
621
+ fixed64 time_unix_nano = 3;
529
622
 
530
- // (Optional) Span ID of the exemplar trace.
531
- // span_id may be missing if the measurement is not recorded inside a trace
532
- // or if the trace is not sampled.
533
- bytes span_id = 4;
623
+ // count is the number of values in the population. Must be non-negative.
624
+ fixed64 count = 4;
534
625
 
535
- // (Optional) Trace ID of the exemplar trace.
536
- // trace_id may be missing if the measurement is not recorded inside a trace
537
- // or if the trace is not sampled.
538
- bytes trace_id = 5;
626
+ // sum of the values in the population. If count is zero then this field
627
+ // must be zero.
628
+ //
629
+ // Note: Sum should only be filled out when measuring non-negative discrete
630
+ // events, and is assumed to be monotonic over the values of these events.
631
+ // Negative events *can* be recorded, but sum should not be filled out when
632
+ // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
633
+ // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary
634
+ double sum = 5;
635
+
636
+ // Represents the value at a given quantile of a distribution.
637
+ //
638
+ // To record Min and Max values following conventions are used:
639
+ // - The 1.0 quantile is equivalent to the maximum value observed.
640
+ // - The 0.0 quantile is equivalent to the minimum value observed.
641
+ //
642
+ // See the following issue for more context:
643
+ // https://github.com/open-telemetry/opentelemetry-proto/issues/125
644
+ message ValueAtQuantile {
645
+ // The quantile of a distribution. Must be in the interval
646
+ // [0.0, 1.0].
647
+ double quantile = 1;
648
+
649
+ // The value at the given quantile of a distribution.
650
+ //
651
+ // Quantile values must NOT be negative.
652
+ double value = 2;
653
+ }
654
+
655
+ // (Optional) list of values at different quantiles of the distribution calculated
656
+ // from the current snapshot. The quantiles must be strictly increasing.
657
+ repeated ValueAtQuantile quantile_values = 6;
658
+
659
+ // Flags that apply to this specific data point. See DataPointFlags
660
+ // for the available flags and their meaning.
661
+ uint32 flags = 8;
539
662
  }
540
663
 
541
- // A representation of an exemplar, which is a sample input double measurement.
664
+ // A representation of an exemplar, which is a sample input measurement.
542
665
  // Exemplars also hold information about the environment when the measurement
543
666
  // was recorded, for example the span and trace ID of the active span when the
544
667
  // exemplar was recorded.
545
- message DoubleExemplar {
546
- // The set of labels that were filtered out by the aggregator, but recorded
547
- // alongside the original measurement. Only labels that were filtered out
548
- // by the aggregator should be included
549
- repeated opentelemetry.proto.common.v1.StringKeyValue filtered_labels = 1;
668
+ message Exemplar {
669
+ reserved 1;
670
+
671
+ // The set of key/value pairs that were filtered out by the aggregator, but
672
+ // recorded alongside the original measurement. Only key/value pairs that were
673
+ // filtered out by the aggregator should be included
674
+ repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7;
550
675
 
551
676
  // time_unix_nano is the exact time when this exemplar was recorded
552
677
  //
@@ -554,8 +679,13 @@ message DoubleExemplar {
554
679
  // 1970.
555
680
  fixed64 time_unix_nano = 2;
556
681
 
557
- // Numerical double value of the measurement that was recorded.
558
- double value = 3;
682
+ // The value of the measurement that was recorded. An exemplar is
683
+ // considered invalid when one of the recognized value fields is not present
684
+ // inside this oneof.
685
+ oneof value {
686
+ double as_double = 3;
687
+ sfixed64 as_int = 6;
688
+ }
559
689
 
560
690
  // (Optional) Span ID of the exemplar trace.
561
691
  // span_id may be missing if the measurement is not recorded inside a trace
@@ -566,4 +696,4 @@ message DoubleExemplar {
566
696
  // trace_id may be missing if the measurement is not recorded inside a trace
567
697
  // or if the trace is not sampled.
568
698
  bytes trace_id = 5;
569
- }
699
+ }