Skip to content

Commit 7b33f20

Browse files
authored
Add Exemplar support to Metrics proto (#159)
* Add exemplars to proto * handle just exemplars, nit fixes * comments * rawvalue -> exemplar, remove sample_count
1 parent e53be03 commit 7b33f20

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

opentelemetry/proto/metrics/v1/metrics.proto

Lines changed: 43 additions & 0 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
@@ -348,6 +375,10 @@ message Int64DataPoint {
348375

349376
// value itself.
350377
int64 value = 4;
378+
379+
// (Optional) List of exemplars collected from
380+
// measurements that were used to form the data point
381+
repeated Exemplar exemplars = 5;
351382
}
352383

353384
// DoubleDataPoint is a single data point in a timeseries that describes the time-varying
@@ -378,6 +409,10 @@ message DoubleDataPoint {
378409

379410
// value itself.
380411
double value = 4;
412+
413+
// (Optional) List of exemplars collected from
414+
// measurements that were used to form the data point
415+
repeated Exemplar exemplars = 5;
381416
}
382417

383418
// HistogramDataPoint is a single data point in a timeseries that describes the time-varying
@@ -448,6 +483,10 @@ message HistogramDataPoint {
448483
// If we decide to also support (a, b] intervals we should add support for these by defining
449484
// a boolean value which decides what type of intervals to use.
450485
repeated double explicit_bounds = 7;
486+
487+
// (Optional) List of exemplars collected from
488+
// measurements that were used to form the data point
489+
repeated Exemplar exemplars = 8;
451490
}
452491

453492
// SummaryDataPoint is a single data point in a timeseries that describes the time-varying
@@ -504,4 +543,8 @@ message SummaryDataPoint {
504543
// A list of values at different quantiles of the distribution calculated
505544
// from the current snapshot. The quantiles must be strictly increasing.
506545
repeated ValueAtQuantile quantile_values = 6;
546+
547+
// (Optional) List of exemplars collected from
548+
// measurements that were used to form the data point
549+
repeated Exemplar exemplars = 7;
507550
}

0 commit comments

Comments
 (0)