Skip to content

Commit 8ff66ad

Browse files
cnnradamsbogdandrutu
authored andcommitted
Add Exemplar support to Metrics proto (open-telemetry#159)
* Add exemplars to proto * handle just exemplars, nit fixes * comments * rawvalue -> exemplar, remove sample_count
1 parent e53be03 commit 8ff66ad

1 file changed

Lines changed: 40 additions & 76 deletions

File tree

opentelemetry/proto/metrics/v1/metrics.proto

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

47+
// A representation of an exemplar, which is a sample input measurement.
48+
// Exemplars also hold information about the environment when the measurement was recorded,
49+
// for example the span and trace ID of the active span when the exemplar was recorded.
50+
message Exemplar {
51+
// The set of labels that were dropped by the aggregator, but recorded
52+
// alongside the original measurement. Only labels that were dropped by the aggregator should be included
53+
repeated opentelemetry.proto.common.v1.StringKeyValue dropped_labels = 1;
54+
55+
// time_unix_nano is the exact time when this exemplar was recorded
56+
//
57+
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
58+
fixed64 time_unix_nano = 2;
59+
60+
// Numerical value of the measurement that was recorded. Only one of these
61+
// two fields is used for the data, based on MetricDescriptor.measurement_value_type
62+
double double_value = 3;
63+
int64 int64_value = 4;
64+
65+
// (Optional) Span ID of the current trace.
66+
// span_id may be missing if the measurement is not recorded inside a trace or if the trace is not sampled.
67+
bytes span_id = 5;
68+
69+
// (Optional) Trace ID of the current trace.
70+
// trace_id may be missing if the measurement is not recorded inside a trace or if the trace is not sampled.
71+
bytes trace_id = 6;
72+
}
73+
4774
// Defines a Metric which has one or more timeseries.
4875
//
4976
// The data model and relation between entities is shown in the
@@ -110,7 +137,6 @@ message Metric {
110137
repeated Int64DataPoint int64_data_points = 2;
111138
repeated DoubleDataPoint double_data_points = 3;
112139
repeated HistogramDataPoint histogram_data_points = 4;
113-
repeated SummaryDataPoint summary_data_points = 5;
114140
}
115141

116142
// Defines a metric type and its schema.
@@ -127,8 +153,7 @@ message MetricDescriptor {
127153

128154
// MeasurementValueType determines the value type for a measurement.
129155
// TODO: There is an open question about whether this should control int64 vs
130-
// double for Histogram and Summary. There are good arguments on both sides of
131-
// this.
156+
// double for Histogram. There are good arguments on both sides of this.
132157
enum MeasurementValueType {
133158
// UNSPECIFIED is the default MeasurementValueType, it MUST not be
134159
// used.
@@ -206,22 +231,6 @@ message MetricDescriptor {
206231
AggregationTemporality aggregation_temporality = 2;
207232
}
208233

209-
// Represents the type of a metric that is calculated by computing a summary
210-
// of all reported measurements over a time interval.
211-
//
212-
// A Metric of this Type MUST store its values as SummaryDataPoint.
213-
message Summary {
214-
// It describes the value type of the measurement used to build this
215-
// aggregation.
216-
//
217-
// Determines the value type of the exemplars.
218-
MeasurementValueType measurement_value_type = 1;
219-
220-
// aggregation_temporality describes if the aggregator reports delta changes
221-
// since last report time, or cumulative changes since a fixed start time.
222-
AggregationTemporality aggregation_temporality = 2;
223-
}
224-
225234
// Type determines the aggregation type (if any) of the metric, what is the
226235
// reported value type for the data points, as well as the relatationship to
227236
// the time interval over which they are reported.
@@ -235,7 +244,7 @@ message MetricDescriptor {
235244
// ----------------------------------------------
236245
// Counter Sum(aggregation_temporality=delta;is_monotonic=true)
237246
// UpDownCounter Sum(aggregation_temporality=delta;is_monotonic=false)
238-
// ValueRecorder Summary(aggregation_temporality=delta)
247+
// ValueRecorder TBD
239248
// SumObserver Sum(aggregation_temporality=cumulative;is_monotonic=true)
240249
// UpDownSumObserver Sum(aggregation_temporality=cumulative;is_monotonic=false)
241250
// ValueObserver Gauge()
@@ -245,7 +254,6 @@ message MetricDescriptor {
245254
Gauge gauge = 4;
246255
Sum sum = 5;
247256
Histogram histogram = 6;
248-
Summary summary = 7;
249257
}
250258

251259
// AggregationTemporality defines how a metric aggregator reports aggregated
@@ -348,6 +356,10 @@ message Int64DataPoint {
348356

349357
// value itself.
350358
int64 value = 4;
359+
360+
// (Optional) List of exemplars collected from
361+
// measurements that were used to form the data point
362+
repeated Exemplar exemplars = 5;
351363
}
352364

353365
// DoubleDataPoint is a single data point in a timeseries that describes the time-varying
@@ -378,6 +390,10 @@ message DoubleDataPoint {
378390

379391
// value itself.
380392
double value = 4;
393+
394+
// (Optional) List of exemplars collected from
395+
// measurements that were used to form the data point
396+
repeated Exemplar exemplars = 5;
381397
}
382398

383399
// HistogramDataPoint is a single data point in a timeseries that describes the time-varying
@@ -448,60 +464,8 @@ message HistogramDataPoint {
448464
// If we decide to also support (a, b] intervals we should add support for these by defining
449465
// a boolean value which decides what type of intervals to use.
450466
repeated double explicit_bounds = 7;
451-
}
452-
453-
// SummaryDataPoint is a single data point in a timeseries that describes the time-varying
454-
// values of a Summary metric.
455-
message SummaryDataPoint {
456-
// The set of labels that uniquely identify this timeseries.
457-
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
458-
459-
// start_time_unix_nano is the last time when the aggregation value was reset
460-
// to "zero". For some metric types this is ignored, see MetricsDescriptor
461-
// types for more details.
462-
//
463-
// The aggregation value is over the time interval (start_time_unix_nano,
464-
// time_unix_nano].
465-
//
466-
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
467-
// 1970.
468-
//
469-
// Value of 0 indicates that the timestamp is unspecified. In that case the
470-
// timestamp may be decided by the backend.
471-
fixed64 start_time_unix_nano = 2;
472-
473-
// time_unix_nano is the moment when this aggregation value was reported.
474-
//
475-
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
476-
// 1970.
477-
fixed64 time_unix_nano = 3;
478-
479-
// The total number of recorded values since start_time. Optional since
480-
// some systems don't expose this.
481-
uint64 count = 4;
482-
483-
// The total sum of recorded values since start_time. Optional since some
484-
// systems don't expose this. If count is zero then this field must be zero.
485-
double sum = 5;
486-
487-
// Represents the value at a given quantile of a distribution.
488-
//
489-
// To record Min and Max values following conventions are used:
490-
// - The 1.0 quantile is equivalent to the maximum value observed.
491-
// - The 0.0 quantile is equivalent to the minimum value observed.
492-
//
493-
// See the following issue for more context:
494-
// https://github.com/open-telemetry/opentelemetry-proto/issues/125
495-
message ValueAtQuantile {
496-
// The quantile of a distribution. Must be in the interval
497-
// [0.0, 1.0].
498-
double quantile = 1;
499-
500-
// The value at the given quantile of a distribution.
501-
double value = 2;
502-
}
503467

504-
// A list of values at different quantiles of the distribution calculated
505-
// from the current snapshot. The quantiles must be strictly increasing.
506-
repeated ValueAtQuantile quantile_values = 6;
468+
// (Optional) List of exemplars collected from
469+
// measurements that were used to form the data point
470+
repeated Exemplar exemplars = 8;
507471
}

0 commit comments

Comments
 (0)