Skip to content

Commit ebe42bf

Browse files
committed
Add exemplars to proto
1 parent 7ae34aa commit ebe42bf

1 file changed

Lines changed: 46 additions & 21 deletions

File tree

opentelemetry/proto/metrics/v1/metrics.proto

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,35 @@ message InstrumentationLibraryMetrics {
4444
repeated Metric metrics = 2;
4545
}
4646

47+
// A representation of raw measurements, which can have statistical meaning based
48+
// on how the measurement was sampled, as well as a span ID and trace ID of the
49+
// active span when the measurement was recorded
50+
message RawValue {
51+
// Numerical value of the measurement that was recorded. Only one of these
52+
// two fields is used for the data, based on MetricDescriptor.measurement_type
53+
double double_value = 1;
54+
int64 int64_value = 2;
55+
56+
// Exact time that the measurement was recorded
57+
fixed64 time_unix_nano = 3;
58+
59+
// For RawValue data points, this is the set of labels that uniquely identify this timeseries.
60+
// Only labels kept by the aggregator (and not dropped labels) should be included.
61+
// For exemplars, this is the set of labels that were dropped by the aggregator, but recorded
62+
// alongside the original measurement. Only labels that were dropped by the aggregator should be included
63+
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 4;
64+
65+
// (Optional) Span ID of the current trace
66+
bytes span_id = 5;
67+
68+
// (Optional) Trace ID of the current trace
69+
bytes trace_id = 6;
70+
71+
// (Optional) When sample_count is non-zero, this exemplar has been chosen in a statistically
72+
// unbiased way such that the exemplar is representative of `sample_count` individual events
73+
double sample_count = 7;
74+
}
75+
4776
// Defines a Metric which has one or more timeseries.
4877
//
4978
// The data model and relation between entities is shown in the
@@ -111,6 +140,7 @@ message Metric {
111140
repeated DoubleDataPoint double_data_points = 3;
112141
repeated HistogramDataPoint histogram_data_points = 4;
113142
repeated SummaryDataPoint summary_data_points = 5;
143+
repeated RawValue raw_data_points = 6;
114144
}
115145

116146
// Defines a metric type and its schema.
@@ -357,6 +387,10 @@ message Int64DataPoint {
357387

358388
// value itself.
359389
int64 value = 4;
390+
391+
// (Optional) List of exemplars collected from
392+
// measurements that were used to form the data point
393+
repeated RawValue exemplars = 5;
360394
}
361395

362396
// DoubleDataPoint is a single data point in a timeseries that describes the time-varying
@@ -382,6 +416,10 @@ message DoubleDataPoint {
382416

383417
// value itself.
384418
double value = 4;
419+
420+
// (Optional) List of exemplars collected from
421+
// measurements that were used to form the data point
422+
repeated RawValue exemplars = 5;
385423
}
386424

387425
// HistogramDataPoint is a single data point in a timeseries that describes the time-varying
@@ -419,27 +457,6 @@ message HistogramDataPoint {
419457
// The number of values in each bucket of the histogram, as described by
420458
// bucket_options.
421459
uint64 count = 1;
422-
423-
// Exemplars are example points that may be used to annotate aggregated
424-
// Histogram values. They are metadata that gives information about a
425-
// particular value added to a Histogram bucket.
426-
message Exemplar {
427-
// Value of the exemplar point. It determines which bucket the exemplar belongs to.
428-
// If bucket_options define bounds for this bucket then this value must be within
429-
// the defined bounds.
430-
double value = 1;
431-
432-
// time_unix_nano is the moment when this exemplar was recorded.
433-
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
434-
fixed64 time_unix_nano = 2;
435-
436-
// exemplar_attachments are contextual information about the example value.
437-
// Keys in this list must be unique.
438-
repeated opentelemetry.proto.common.v1.StringKeyValue attachments = 3;
439-
}
440-
441-
// exemplar is an optional representative value of the bucket.
442-
Exemplar exemplar = 2;
443460
}
444461

445462
// buckets is an optional field contains the values of histogram for each bucket.
@@ -477,6 +494,10 @@ message HistogramDataPoint {
477494
// If we decide to also support (a, b] intervals we should add support for these by defining
478495
// a boolean value which decides what type of intervals to use.
479496
repeated double explicit_bounds = 7;
497+
498+
// (Optional) List of exemplars collected from
499+
// measurements that were used to form the data point
500+
repeated RawValue exemplars = 8;
480501
}
481502

482503
// SummaryDataPoint is a single data point in a timeseries that describes the time-varying
@@ -526,4 +547,8 @@ message SummaryDataPoint {
526547
// A list of values at different quantiles of the distribution calculated
527548
// from the current snapshot. The quantiles must be strictly increasing.
528549
repeated ValueAtQuantile quantile_values = 6;
550+
551+
// (Optional) List of exemplars collected from
552+
// measurements that were used to form the data point
553+
repeated RawValue exemplars = 7;
529554
}

0 commit comments

Comments
 (0)