opentelemetry_proto/proto/tonic/opentelemetry.proto.metrics.v1.rs
1// This file is @generated by prost-build.
2/// MetricsData represents the metrics data that can be stored in a persistent
3/// storage, OR can be embedded by other protocols that transfer OTLP metrics
4/// data but do not implement the OTLP protocol.
5///
6/// MetricsData
7/// └─── ResourceMetrics
8/// ├── Resource
9/// ├── SchemaURL
10/// └── ScopeMetrics
11/// ├── Scope
12/// ├── SchemaURL
13/// └── Metric
14/// ├── Name
15/// ├── Description
16/// ├── Unit
17/// └── data
18/// ├── Gauge
19/// ├── Sum
20/// ├── Histogram
21/// ├── ExponentialHistogram
22/// └── Summary
23///
24/// The main difference between this message and collector protocol is that
25/// in this message there will not be any "control" or "metadata" specific to
26/// OTLP protocol.
27///
28/// When new fields are added into this message, the OTLP request MUST be updated
29/// as well.
30#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
31#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
32#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
33#[derive(Clone, PartialEq, ::prost::Message)]
34pub struct MetricsData {
35 /// An array of ResourceMetrics.
36 /// For data coming from a single resource this array will typically contain
37 /// one element. Intermediary nodes that receive data from multiple origins
38 /// typically batch the data before forwarding further and in that case this
39 /// array will contain multiple elements.
40 #[prost(message, repeated, tag = "1")]
41 pub resource_metrics: ::prost::alloc::vec::Vec<ResourceMetrics>,
42}
43/// A collection of ScopeMetrics from a Resource.
44#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
45#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
46#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
47#[cfg_attr(feature = "with-serde", serde(default))]
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct ResourceMetrics {
50 /// The resource for the metrics in this message.
51 /// If this field is not set then no resource info is known.
52 #[prost(message, optional, tag = "1")]
53 pub resource: ::core::option::Option<super::super::resource::v1::Resource>,
54 /// A list of metrics that originate from a resource.
55 #[prost(message, repeated, tag = "2")]
56 pub scope_metrics: ::prost::alloc::vec::Vec<ScopeMetrics>,
57 /// The Schema URL, if known. This is the identifier of the Schema that the resource data
58 /// is recorded in. Notably, the last part of the URL path is the version number of the
59 /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
60 /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
61 /// This schema_url applies to the data in the "resource" field. It does not apply
62 /// to the data in the "scope_metrics" field which have their own schema_url field.
63 #[prost(string, tag = "3")]
64 pub schema_url: ::prost::alloc::string::String,
65}
66/// A collection of Metrics produced by an Scope.
67#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
68#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
69#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
70#[cfg_attr(feature = "with-serde", serde(default))]
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct ScopeMetrics {
73 /// The instrumentation scope information for the metrics in this message.
74 /// Semantically when InstrumentationScope isn't set, it is equivalent with
75 /// an empty instrumentation scope name (unknown).
76 #[prost(message, optional, tag = "1")]
77 pub scope: ::core::option::Option<super::super::common::v1::InstrumentationScope>,
78 /// A list of metrics that originate from an instrumentation library.
79 #[prost(message, repeated, tag = "2")]
80 pub metrics: ::prost::alloc::vec::Vec<Metric>,
81 /// The Schema URL, if known. This is the identifier of the Schema that the metric data
82 /// is recorded in. Notably, the last part of the URL path is the version number of the
83 /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
84 /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
85 /// This schema_url applies to all metrics in the "metrics" field.
86 #[prost(string, tag = "3")]
87 pub schema_url: ::prost::alloc::string::String,
88}
89/// Defines a Metric which has one or more timeseries. The following is a
90/// brief summary of the Metric data model. For more details, see:
91///
92/// <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md>
93///
94/// The data model and relation between entities is shown in the
95/// diagram below. Here, "DataPoint" is the term used to refer to any
96/// one of the specific data point value types, and "points" is the term used
97/// to refer to any one of the lists of points contained in the Metric.
98///
99/// * Metric is composed of a metadata and data.
100///
101/// * Metadata part contains a name, description, unit.
102///
103/// * Data is one of the possible types (Sum, Gauge, Histogram, Summary).
104///
105/// * DataPoint contains timestamps, attributes, and one of the possible value type
106/// fields.
107///
108/// Metric
109/// +------------+
110/// \|name |
111/// \|description |
112/// \|unit | +------------------------------------+
113/// \|data |---> |Gauge, Sum, Histogram, Summary, ... |
114/// +------------+ +------------------------------------+
115///
116/// Data \[One of Gauge, Sum, Histogram, Summary, ...\]
117/// +-----------+
118/// \|... | // Metadata about the Data.
119/// \|points |--+
120/// +-----------+ |
121/// \| +---------------------------+
122/// \| |DataPoint 1 |
123/// v |+------+------+ +------+ |
124/// +-----+ ||label |label |...|label | |
125/// \| 1 |-->||value1|value2|...|valueN| |
126/// +-----+ |+------+------+ +------+ |
127/// \| . | |+-----+ |
128/// \| . | ||value| |
129/// \| . | |+-----+ |
130/// \| . | +---------------------------+
131/// \| . | .
132/// \| . | .
133/// \| . | .
134/// \| . | +---------------------------+
135/// \| . | |DataPoint M |
136/// +-----+ |+------+------+ +------+ |
137/// \| M |-->||label |label |...|label | |
138/// +-----+ ||value1|value2|...|valueN| |
139/// \|+------+------+ +------+ |
140/// \|+-----+ |
141/// \||value| |
142/// \|+-----+ |
143/// +---------------------------+
144///
145/// Each distinct type of DataPoint represents the output of a specific
146/// aggregation function, the result of applying the DataPoint's
147/// associated function of to one or more measurements.
148///
149/// All DataPoint types have three common fields:
150///
151/// * Attributes includes key-value pairs associated with the data point
152/// * TimeUnixNano is required, set to the end time of the aggregation
153/// * StartTimeUnixNano is optional, but strongly encouraged for DataPoints
154/// having an AggregationTemporality field, as discussed below.
155///
156/// Both TimeUnixNano and StartTimeUnixNano values are expressed as
157/// UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
158///
159/// # TimeUnixNano
160///
161/// This field is required, having consistent interpretation across
162/// DataPoint types. TimeUnixNano is the moment corresponding to when
163/// the data point's aggregate value was captured.
164///
165/// Data points with the 0 value for TimeUnixNano SHOULD be rejected
166/// by consumers.
167///
168/// # StartTimeUnixNano
169///
170/// StartTimeUnixNano in general allows detecting when a sequence of
171/// observations is unbroken. This field indicates to consumers the
172/// start time for points with cumulative and delta
173/// AggregationTemporality, and it should be included whenever possible
174/// to support correct rate calculation. Although it may be omitted
175/// when the start time is truly unknown, setting StartTimeUnixNano is
176/// strongly encouraged.
177#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
178#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
179#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
180#[cfg_attr(feature = "with-serde", serde(default))]
181#[derive(Clone, PartialEq, ::prost::Message)]
182pub struct Metric {
183 /// name of the metric.
184 #[prost(string, tag = "1")]
185 pub name: ::prost::alloc::string::String,
186 /// description of the metric, which can be used in documentation.
187 #[prost(string, tag = "2")]
188 pub description: ::prost::alloc::string::String,
189 /// unit in which the metric value is reported. Follows the format
190 /// described by <https://unitsofmeasure.org/ucum.html.>
191 #[prost(string, tag = "3")]
192 pub unit: ::prost::alloc::string::String,
193 /// Additional metadata attributes that describe the metric. \[Optional\].
194 /// Attributes are non-identifying.
195 /// Consumers SHOULD NOT need to be aware of these attributes.
196 /// These attributes MAY be used to encode information allowing
197 /// for lossless roundtrip translation to / from another data model.
198 /// Attribute keys MUST be unique (it is not allowed to have more than one
199 /// attribute with the same key).
200 #[prost(message, repeated, tag = "12")]
201 pub metadata: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
202 /// Data determines the aggregation type (if any) of the metric, what is the
203 /// reported value type for the data points, as well as the relatationship to
204 /// the time interval over which they are reported.
205 #[prost(oneof = "metric::Data", tags = "5, 7, 9, 10, 11")]
206 #[cfg_attr(feature = "with-serde", serde(flatten))]
207 pub data: ::core::option::Option<metric::Data>,
208}
209/// Nested message and enum types in `Metric`.
210pub mod metric {
211 /// Data determines the aggregation type (if any) of the metric, what is the
212 /// reported value type for the data points, as well as the relatationship to
213 /// the time interval over which they are reported.
214 #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
215 #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
216 #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
217 #[derive(Clone, PartialEq, ::prost::Oneof)]
218 pub enum Data {
219 #[prost(message, tag = "5")]
220 Gauge(super::Gauge),
221 #[prost(message, tag = "7")]
222 Sum(super::Sum),
223 #[prost(message, tag = "9")]
224 Histogram(super::Histogram),
225 #[prost(message, tag = "10")]
226 ExponentialHistogram(super::ExponentialHistogram),
227 #[prost(message, tag = "11")]
228 Summary(super::Summary),
229 }
230}
231/// Gauge represents the type of a scalar metric that always exports the
232/// "current value" for every data point. It should be used for an "unknown"
233/// aggregation.
234///
235/// A Gauge does not support different aggregation temporalities. Given the
236/// aggregation is unknown, points cannot be combined using the same
237/// aggregation, regardless of aggregation temporalities. Therefore,
238/// AggregationTemporality is not included. Consequently, this also means
239/// "StartTimeUnixNano" is ignored for all data points.
240#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
241#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
242#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
243#[cfg_attr(feature = "with-serde", serde(default))]
244#[derive(Clone, PartialEq, ::prost::Message)]
245pub struct Gauge {
246 #[prost(message, repeated, tag = "1")]
247 pub data_points: ::prost::alloc::vec::Vec<NumberDataPoint>,
248}
249/// Sum represents the type of a scalar metric that is calculated as a sum of all
250/// reported measurements over a time interval.
251#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
252#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
253#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
254#[cfg_attr(feature = "with-serde", serde(default))]
255#[derive(Clone, PartialEq, ::prost::Message)]
256pub struct Sum {
257 #[prost(message, repeated, tag = "1")]
258 pub data_points: ::prost::alloc::vec::Vec<NumberDataPoint>,
259 /// aggregation_temporality describes if the aggregator reports delta changes
260 /// since last report time, or cumulative changes since a fixed start time.
261 #[prost(enumeration = "AggregationTemporality", tag = "2")]
262 pub aggregation_temporality: i32,
263 /// If "true" means that the sum is monotonic.
264 #[prost(bool, tag = "3")]
265 pub is_monotonic: bool,
266}
267/// Histogram represents the type of a metric that is calculated by aggregating
268/// as a Histogram of all reported measurements over a time interval.
269#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
270#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
271#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
272#[cfg_attr(feature = "with-serde", serde(default))]
273#[derive(Clone, PartialEq, ::prost::Message)]
274pub struct Histogram {
275 #[prost(message, repeated, tag = "1")]
276 pub data_points: ::prost::alloc::vec::Vec<HistogramDataPoint>,
277 /// aggregation_temporality describes if the aggregator reports delta changes
278 /// since last report time, or cumulative changes since a fixed start time.
279 #[prost(enumeration = "AggregationTemporality", tag = "2")]
280 pub aggregation_temporality: i32,
281}
282/// ExponentialHistogram represents the type of a metric that is calculated by aggregating
283/// as a ExponentialHistogram of all reported double measurements over a time interval.
284#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
285#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
286#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
287#[cfg_attr(feature = "with-serde", serde(default))]
288#[derive(Clone, PartialEq, ::prost::Message)]
289pub struct ExponentialHistogram {
290 #[prost(message, repeated, tag = "1")]
291 pub data_points: ::prost::alloc::vec::Vec<ExponentialHistogramDataPoint>,
292 /// aggregation_temporality describes if the aggregator reports delta changes
293 /// since last report time, or cumulative changes since a fixed start time.
294 #[prost(enumeration = "AggregationTemporality", tag = "2")]
295 pub aggregation_temporality: i32,
296}
297/// Summary metric data are used to convey quantile summaries,
298/// a Prometheus (see: <https://prometheus.io/docs/concepts/metric_types/#summary>)
299/// and OpenMetrics (see: <https://github.com/prometheus/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45>)
300/// data type. These data points cannot always be merged in a meaningful way.
301/// While they can be useful in some applications, histogram data points are
302/// recommended for new applications.
303/// Summary metrics do not have an aggregation temporality field. This is
304/// because the count and sum fields of a SummaryDataPoint are assumed to be
305/// cumulative values.
306#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
307#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
308#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
309#[cfg_attr(feature = "with-serde", serde(default))]
310#[derive(Clone, PartialEq, ::prost::Message)]
311pub struct Summary {
312 #[prost(message, repeated, tag = "1")]
313 pub data_points: ::prost::alloc::vec::Vec<SummaryDataPoint>,
314}
315/// NumberDataPoint is a single data point in a timeseries that describes the
316/// time-varying scalar value of a metric.
317#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
318#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
319#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
320#[cfg_attr(feature = "with-serde", serde(default))]
321#[derive(Clone, PartialEq, ::prost::Message)]
322pub struct NumberDataPoint {
323 /// The set of key/value pairs that uniquely identify the timeseries from
324 /// where this point belongs. The list may be empty (may contain 0 elements).
325 /// Attribute keys MUST be unique (it is not allowed to have more than one
326 /// attribute with the same key).
327 ///
328 /// The attribute values SHOULD NOT contain empty values.
329 /// The attribute values SHOULD NOT contain bytes values.
330 /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
331 /// double values.
332 /// The attribute values SHOULD NOT contain kvlist values.
333 /// The behavior of software that receives attributes containing such values can be unpredictable.
334 /// These restrictions can change in a minor release.
335 /// The restrictions take origin from the OpenTelemetry specification:
336 /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
337 #[prost(message, repeated, tag = "7")]
338 pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
339 /// StartTimeUnixNano is optional but strongly encouraged, see the
340 /// the detailed comments above Metric.
341 ///
342 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
343 /// 1970.
344 #[prost(fixed64, tag = "2")]
345 #[cfg_attr(
346 feature = "with-serde",
347 serde(
348 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
349 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
350 )
351 )]
352 pub start_time_unix_nano: u64,
353 /// TimeUnixNano is required, see the detailed comments above Metric.
354 ///
355 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
356 /// 1970.
357 #[prost(fixed64, tag = "3")]
358 #[cfg_attr(
359 feature = "with-serde",
360 serde(
361 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
362 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
363 )
364 )]
365 pub time_unix_nano: u64,
366 /// (Optional) List of exemplars collected from
367 /// measurements that were used to form the data point
368 #[prost(message, repeated, tag = "5")]
369 pub exemplars: ::prost::alloc::vec::Vec<Exemplar>,
370 /// Flags that apply to this specific data point. See DataPointFlags
371 /// for the available flags and their meaning.
372 #[prost(uint32, tag = "8")]
373 pub flags: u32,
374 /// The value itself. A point is considered invalid when one of the recognized
375 /// value fields is not present inside this oneof.
376 #[prost(oneof = "number_data_point::Value", tags = "4, 6")]
377 #[cfg_attr(feature = "with-serde", serde(flatten))]
378 pub value: ::core::option::Option<number_data_point::Value>,
379}
380/// Nested message and enum types in `NumberDataPoint`.
381pub mod number_data_point {
382 /// The value itself. A point is considered invalid when one of the recognized
383 /// value fields is not present inside this oneof.
384 #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
385 #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
386 #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
387 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
388 pub enum Value {
389 #[prost(double, tag = "4")]
390 AsDouble(f64),
391 #[prost(sfixed64, tag = "6")]
392 AsInt(i64),
393 }
394}
395/// HistogramDataPoint is a single data point in a timeseries that describes the
396/// time-varying values of a Histogram. A Histogram contains summary statistics
397/// for a population of values, it may optionally contain the distribution of
398/// those values across a set of buckets.
399///
400/// If the histogram contains the distribution of values, then both
401/// "explicit_bounds" and "bucket counts" fields must be defined.
402/// If the histogram does not contain the distribution of values, then both
403/// "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
404/// "sum" are known.
405#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
406#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
407#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
408#[cfg_attr(feature = "with-serde", serde(default))]
409#[derive(Clone, PartialEq, ::prost::Message)]
410pub struct HistogramDataPoint {
411 /// The set of key/value pairs that uniquely identify the timeseries from
412 /// where this point belongs. The list may be empty (may contain 0 elements).
413 /// Attribute keys MUST be unique (it is not allowed to have more than one
414 /// attribute with the same key).
415 ///
416 /// The attribute values SHOULD NOT contain empty values.
417 /// The attribute values SHOULD NOT contain bytes values.
418 /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
419 /// double values.
420 /// The attribute values SHOULD NOT contain kvlist values.
421 /// The behavior of software that receives attributes containing such values can be unpredictable.
422 /// These restrictions can change in a minor release.
423 /// The restrictions take origin from the OpenTelemetry specification:
424 /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
425 #[prost(message, repeated, tag = "9")]
426 pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
427 /// StartTimeUnixNano is optional but strongly encouraged, see the
428 /// the detailed comments above Metric.
429 ///
430 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
431 /// 1970.
432 #[prost(fixed64, tag = "2")]
433 #[cfg_attr(
434 feature = "with-serde",
435 serde(
436 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
437 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
438 )
439 )]
440 pub start_time_unix_nano: u64,
441 /// TimeUnixNano is required, see the detailed comments above Metric.
442 ///
443 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
444 /// 1970.
445 #[prost(fixed64, tag = "3")]
446 #[cfg_attr(
447 feature = "with-serde",
448 serde(
449 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
450 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
451 )
452 )]
453 pub time_unix_nano: u64,
454 /// count is the number of values in the population. Must be non-negative. This
455 /// value must be equal to the sum of the "count" fields in buckets if a
456 /// histogram is provided.
457 #[prost(fixed64, tag = "4")]
458 pub count: u64,
459 /// sum of the values in the population. If count is zero then this field
460 /// must be zero.
461 ///
462 /// Note: Sum should only be filled out when measuring non-negative discrete
463 /// events, and is assumed to be monotonic over the values of these events.
464 /// Negative events *can* be recorded, but sum should not be filled out when
465 /// doing so. This is specifically to enforce compatibility w/ OpenMetrics,
466 /// see: <https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram>
467 #[prost(double, optional, tag = "5")]
468 pub sum: ::core::option::Option<f64>,
469 /// bucket_counts is an optional field contains the count values of histogram
470 /// for each bucket.
471 ///
472 /// The sum of the bucket_counts must equal the value in the count field.
473 ///
474 /// The number of elements in bucket_counts array must be by one greater than
475 /// the number of elements in explicit_bounds array. The exception to this rule
476 /// is when the length of bucket_counts is 0, then the length of explicit_bounds
477 /// must also be 0.
478 #[prost(fixed64, repeated, tag = "6")]
479 pub bucket_counts: ::prost::alloc::vec::Vec<u64>,
480 /// explicit_bounds specifies buckets with explicitly defined bounds for values.
481 ///
482 /// The boundaries for bucket at index i are:
483 ///
484 /// (-infinity, explicit_bounds\[i\]\] for i == 0
485 /// (explicit_bounds\[i-1\], explicit_bounds\[i\]\] for 0 \< i \< size(explicit_bounds)
486 /// (explicit_bounds\[i-1\], +infinity) for i == size(explicit_bounds)
487 ///
488 /// The values in the explicit_bounds array must be strictly increasing.
489 ///
490 /// Histogram buckets are inclusive of their upper boundary, except the last
491 /// bucket where the boundary is at infinity. This format is intentionally
492 /// compatible with the OpenMetrics histogram definition.
493 ///
494 /// If bucket_counts length is 0 then explicit_bounds length must also be 0,
495 /// otherwise the data point is invalid.
496 #[prost(double, repeated, tag = "7")]
497 pub explicit_bounds: ::prost::alloc::vec::Vec<f64>,
498 /// (Optional) List of exemplars collected from
499 /// measurements that were used to form the data point
500 #[prost(message, repeated, tag = "8")]
501 pub exemplars: ::prost::alloc::vec::Vec<Exemplar>,
502 /// Flags that apply to this specific data point. See DataPointFlags
503 /// for the available flags and their meaning.
504 #[prost(uint32, tag = "10")]
505 pub flags: u32,
506 /// min is the minimum value over (start_time, end_time\].
507 #[prost(double, optional, tag = "11")]
508 pub min: ::core::option::Option<f64>,
509 /// max is the maximum value over (start_time, end_time\].
510 #[prost(double, optional, tag = "12")]
511 pub max: ::core::option::Option<f64>,
512}
513/// ExponentialHistogramDataPoint is a single data point in a timeseries that describes the
514/// time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains
515/// summary statistics for a population of values, it may optionally contain the
516/// distribution of those values across a set of buckets.
517#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
518#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
519#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
520#[derive(Clone, PartialEq, ::prost::Message)]
521pub struct ExponentialHistogramDataPoint {
522 /// The set of key/value pairs that uniquely identify the timeseries from
523 /// where this point belongs. The list may be empty (may contain 0 elements).
524 /// Attribute keys MUST be unique (it is not allowed to have more than one
525 /// attribute with the same key).
526 ///
527 /// The attribute values SHOULD NOT contain empty values.
528 /// The attribute values SHOULD NOT contain bytes values.
529 /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
530 /// double values.
531 /// The attribute values SHOULD NOT contain kvlist values.
532 /// The behavior of software that receives attributes containing such values can be unpredictable.
533 /// These restrictions can change in a minor release.
534 /// The restrictions take origin from the OpenTelemetry specification:
535 /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
536 #[prost(message, repeated, tag = "1")]
537 pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
538 /// StartTimeUnixNano is optional but strongly encouraged, see the
539 /// the detailed comments above Metric.
540 ///
541 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
542 /// 1970.
543 #[prost(fixed64, tag = "2")]
544 pub start_time_unix_nano: u64,
545 /// TimeUnixNano is required, see the detailed comments above Metric.
546 ///
547 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
548 /// 1970.
549 #[prost(fixed64, tag = "3")]
550 pub time_unix_nano: u64,
551 /// count is the number of values in the population. Must be
552 /// non-negative. This value must be equal to the sum of the "bucket_counts"
553 /// values in the positive and negative Buckets plus the "zero_count" field.
554 #[prost(fixed64, tag = "4")]
555 pub count: u64,
556 /// sum of the values in the population. If count is zero then this field
557 /// must be zero.
558 ///
559 /// Note: Sum should only be filled out when measuring non-negative discrete
560 /// events, and is assumed to be monotonic over the values of these events.
561 /// Negative events *can* be recorded, but sum should not be filled out when
562 /// doing so. This is specifically to enforce compatibility w/ OpenMetrics,
563 /// see: <https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram>
564 #[prost(double, optional, tag = "5")]
565 pub sum: ::core::option::Option<f64>,
566 /// scale describes the resolution of the histogram. Boundaries are
567 /// located at powers of the base, where:
568 ///
569 /// base = (2^(2^-scale))
570 ///
571 /// The histogram bucket identified by `index`, a signed integer,
572 /// contains values that are greater than (base^index) and
573 /// less than or equal to (base^(index+1)).
574 ///
575 /// The positive and negative ranges of the histogram are expressed
576 /// separately. Negative values are mapped by their absolute value
577 /// into the negative range using the same scale as the positive range.
578 ///
579 /// scale is not restricted by the protocol, as the permissible
580 /// values depend on the range of the data.
581 #[prost(sint32, tag = "6")]
582 pub scale: i32,
583 /// zero_count is the count of values that are either exactly zero or
584 /// within the region considered zero by the instrumentation at the
585 /// tolerated degree of precision. This bucket stores values that
586 /// cannot be expressed using the standard exponential formula as
587 /// well as values that have been rounded to zero.
588 ///
589 /// Implementations MAY consider the zero bucket to have probability
590 /// mass equal to (zero_count / count).
591 #[prost(fixed64, tag = "7")]
592 pub zero_count: u64,
593 /// positive carries the positive range of exponential bucket counts.
594 #[prost(message, optional, tag = "8")]
595 pub positive: ::core::option::Option<exponential_histogram_data_point::Buckets>,
596 /// negative carries the negative range of exponential bucket counts.
597 #[prost(message, optional, tag = "9")]
598 pub negative: ::core::option::Option<exponential_histogram_data_point::Buckets>,
599 /// Flags that apply to this specific data point. See DataPointFlags
600 /// for the available flags and their meaning.
601 #[prost(uint32, tag = "10")]
602 pub flags: u32,
603 /// (Optional) List of exemplars collected from
604 /// measurements that were used to form the data point
605 #[prost(message, repeated, tag = "11")]
606 pub exemplars: ::prost::alloc::vec::Vec<Exemplar>,
607 /// min is the minimum value over (start_time, end_time\].
608 #[prost(double, optional, tag = "12")]
609 pub min: ::core::option::Option<f64>,
610 /// max is the maximum value over (start_time, end_time\].
611 #[prost(double, optional, tag = "13")]
612 pub max: ::core::option::Option<f64>,
613 /// ZeroThreshold may be optionally set to convey the width of the zero
614 /// region. Where the zero region is defined as the closed interval
615 /// \[-ZeroThreshold, ZeroThreshold\].
616 /// When ZeroThreshold is 0, zero count bucket stores values that cannot be
617 /// expressed using the standard exponential formula as well as values that
618 /// have been rounded to zero.
619 #[prost(double, tag = "14")]
620 pub zero_threshold: f64,
621}
622/// Nested message and enum types in `ExponentialHistogramDataPoint`.
623pub mod exponential_histogram_data_point {
624 /// Buckets are a set of bucket counts, encoded in a contiguous array
625 /// of counts.
626 #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
627 #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
628 #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
629 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
630 pub struct Buckets {
631 /// Offset is the bucket index of the first entry in the bucket_counts array.
632 ///
633 /// Note: This uses a varint encoding as a simple form of compression.
634 #[prost(sint32, tag = "1")]
635 pub offset: i32,
636 /// bucket_counts is an array of count values, where bucket_counts\[i\] carries
637 /// the count of the bucket at index (offset+i). bucket_counts\[i\] is the count
638 /// of values greater than base^(offset+i) and less than or equal to
639 /// base^(offset+i+1).
640 ///
641 /// Note: By contrast, the explicit HistogramDataPoint uses
642 /// fixed64. This field is expected to have many buckets,
643 /// especially zeros, so uint64 has been selected to ensure
644 /// varint encoding.
645 #[prost(uint64, repeated, tag = "2")]
646 pub bucket_counts: ::prost::alloc::vec::Vec<u64>,
647 }
648}
649/// SummaryDataPoint is a single data point in a timeseries that describes the
650/// time-varying values of a Summary metric. The count and sum fields represent
651/// cumulative values.
652#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
653#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
654#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
655#[derive(Clone, PartialEq, ::prost::Message)]
656pub struct SummaryDataPoint {
657 /// The set of key/value pairs that uniquely identify the timeseries from
658 /// where this point belongs. The list may be empty (may contain 0 elements).
659 /// Attribute keys MUST be unique (it is not allowed to have more than one
660 /// attribute with the same key).
661 ///
662 /// The attribute values SHOULD NOT contain empty values.
663 /// The attribute values SHOULD NOT contain bytes values.
664 /// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
665 /// double values.
666 /// The attribute values SHOULD NOT contain kvlist values.
667 /// The behavior of software that receives attributes containing such values can be unpredictable.
668 /// These restrictions can change in a minor release.
669 /// The restrictions take origin from the OpenTelemetry specification:
670 /// <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.>
671 #[prost(message, repeated, tag = "7")]
672 pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
673 /// StartTimeUnixNano is optional but strongly encouraged, see the
674 /// the detailed comments above Metric.
675 ///
676 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
677 /// 1970.
678 #[prost(fixed64, tag = "2")]
679 pub start_time_unix_nano: u64,
680 /// TimeUnixNano is required, see the detailed comments above Metric.
681 ///
682 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
683 /// 1970.
684 #[prost(fixed64, tag = "3")]
685 pub time_unix_nano: u64,
686 /// count is the number of values in the population. Must be non-negative.
687 #[prost(fixed64, tag = "4")]
688 pub count: u64,
689 /// sum of the values in the population. If count is zero then this field
690 /// must be zero.
691 ///
692 /// Note: Sum should only be filled out when measuring non-negative discrete
693 /// events, and is assumed to be monotonic over the values of these events.
694 /// Negative events *can* be recorded, but sum should not be filled out when
695 /// doing so. This is specifically to enforce compatibility w/ OpenMetrics,
696 /// see: <https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#summary>
697 #[prost(double, tag = "5")]
698 pub sum: f64,
699 /// (Optional) list of values at different quantiles of the distribution calculated
700 /// from the current snapshot. The quantiles must be strictly increasing.
701 #[prost(message, repeated, tag = "6")]
702 pub quantile_values: ::prost::alloc::vec::Vec<summary_data_point::ValueAtQuantile>,
703 /// Flags that apply to this specific data point. See DataPointFlags
704 /// for the available flags and their meaning.
705 #[prost(uint32, tag = "8")]
706 pub flags: u32,
707}
708/// Nested message and enum types in `SummaryDataPoint`.
709pub mod summary_data_point {
710 /// Represents the value at a given quantile of a distribution.
711 ///
712 /// To record Min and Max values following conventions are used:
713 ///
714 /// * The 1.0 quantile is equivalent to the maximum value observed.
715 /// * The 0.0 quantile is equivalent to the minimum value observed.
716 ///
717 /// See the following issue for more context:
718 /// <https://github.com/open-telemetry/opentelemetry-proto/issues/125>
719 #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
720 #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
721 #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
722 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
723 pub struct ValueAtQuantile {
724 /// The quantile of a distribution. Must be in the interval
725 /// \[0.0, 1.0\].
726 #[prost(double, tag = "1")]
727 pub quantile: f64,
728 /// The value at the given quantile of a distribution.
729 ///
730 /// Quantile values must NOT be negative.
731 #[prost(double, tag = "2")]
732 pub value: f64,
733 }
734}
735/// A representation of an exemplar, which is a sample input measurement.
736/// Exemplars also hold information about the environment when the measurement
737/// was recorded, for example the span and trace ID of the active span when the
738/// exemplar was recorded.
739#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
740#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
741#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
742#[derive(Clone, PartialEq, ::prost::Message)]
743pub struct Exemplar {
744 /// The set of key/value pairs that were filtered out by the aggregator, but
745 /// recorded alongside the original measurement. Only key/value pairs that were
746 /// filtered out by the aggregator should be included
747 #[prost(message, repeated, tag = "7")]
748 pub filtered_attributes: ::prost::alloc::vec::Vec<
749 super::super::common::v1::KeyValue,
750 >,
751 /// time_unix_nano is the exact time when this exemplar was recorded
752 ///
753 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
754 /// 1970.
755 #[prost(fixed64, tag = "2")]
756 pub time_unix_nano: u64,
757 /// (Optional) Span ID of the exemplar trace.
758 /// span_id may be missing if the measurement is not recorded inside a trace
759 /// or if the trace is not sampled.
760 #[prost(bytes = "vec", tag = "4")]
761 #[cfg_attr(
762 feature = "with-serde",
763 serde(
764 serialize_with = "crate::proto::serializers::serialize_to_hex_string",
765 deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
766 )
767 )]
768 pub span_id: ::prost::alloc::vec::Vec<u8>,
769 /// (Optional) Trace ID of the exemplar trace.
770 /// trace_id may be missing if the measurement is not recorded inside a trace
771 /// or if the trace is not sampled.
772 #[prost(bytes = "vec", tag = "5")]
773 #[cfg_attr(
774 feature = "with-serde",
775 serde(
776 serialize_with = "crate::proto::serializers::serialize_to_hex_string",
777 deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
778 )
779 )]
780 pub trace_id: ::prost::alloc::vec::Vec<u8>,
781 /// The value of the measurement that was recorded. An exemplar is
782 /// considered invalid when one of the recognized value fields is not present
783 /// inside this oneof.
784 #[prost(oneof = "exemplar::Value", tags = "3, 6")]
785 pub value: ::core::option::Option<exemplar::Value>,
786}
787/// Nested message and enum types in `Exemplar`.
788pub mod exemplar {
789 /// The value of the measurement that was recorded. An exemplar is
790 /// considered invalid when one of the recognized value fields is not present
791 /// inside this oneof.
792 #[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
793 #[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
794 #[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
795 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
796 pub enum Value {
797 #[prost(double, tag = "3")]
798 AsDouble(f64),
799 #[prost(sfixed64, tag = "6")]
800 AsInt(i64),
801 }
802}
803/// AggregationTemporality defines how a metric aggregator reports aggregated
804/// values. It describes how those values relate to the time interval over
805/// which they are aggregated.
806#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
807#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
808#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
809#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
810#[repr(i32)]
811pub enum AggregationTemporality {
812 /// UNSPECIFIED is the default AggregationTemporality, it MUST not be used.
813 Unspecified = 0,
814 /// DELTA is an AggregationTemporality for a metric aggregator which reports
815 /// changes since last report time. Successive metrics contain aggregation of
816 /// values from continuous and non-overlapping intervals.
817 ///
818 /// The values for a DELTA metric are based only on the time interval
819 /// associated with one measurement cycle. There is no dependency on
820 /// previous measurements like is the case for CUMULATIVE metrics.
821 ///
822 /// For example, consider a system measuring the number of requests that
823 /// it receives and reports the sum of these requests every second as a
824 /// DELTA metric:
825 ///
826 /// 1. The system starts receiving at time=t_0.
827 /// 1. A request is received, the system measures 1 request.
828 /// 1. A request is received, the system measures 1 request.
829 /// 1. A request is received, the system measures 1 request.
830 /// 1. The 1 second collection cycle ends. A metric is exported for the
831 /// number of requests received over the interval of time t_0 to
832 /// t_0+1 with a value of 3.
833 /// 1. A request is received, the system measures 1 request.
834 /// 1. A request is received, the system measures 1 request.
835 /// 1. The 1 second collection cycle ends. A metric is exported for the
836 /// number of requests received over the interval of time t_0+1 to
837 /// t_0+2 with a value of 2.
838 Delta = 1,
839 /// CUMULATIVE is an AggregationTemporality for a metric aggregator which
840 /// reports changes since a fixed start time. This means that current values
841 /// of a CUMULATIVE metric depend on all previous measurements since the
842 /// start time. Because of this, the sender is required to retain this state
843 /// in some form. If this state is lost or invalidated, the CUMULATIVE metric
844 /// values MUST be reset and a new fixed start time following the last
845 /// reported measurement time sent MUST be used.
846 ///
847 /// For example, consider a system measuring the number of requests that
848 /// it receives and reports the sum of these requests every second as a
849 /// CUMULATIVE metric:
850 ///
851 /// 1. The system starts receiving at time=t_0.
852 /// 1. A request is received, the system measures 1 request.
853 /// 1. A request is received, the system measures 1 request.
854 /// 1. A request is received, the system measures 1 request.
855 /// 1. The 1 second collection cycle ends. A metric is exported for the
856 /// number of requests received over the interval of time t_0 to
857 /// t_0+1 with a value of 3.
858 /// 1. A request is received, the system measures 1 request.
859 /// 1. A request is received, the system measures 1 request.
860 /// 1. The 1 second collection cycle ends. A metric is exported for the
861 /// number of requests received over the interval of time t_0 to
862 /// t_0+2 with a value of 5.
863 /// 1. The system experiences a fault and loses state.
864 /// 1. The system recovers and resumes receiving at time=t_1.
865 /// 1. A request is received, the system measures 1 request.
866 /// 1. The 1 second collection cycle ends. A metric is exported for the
867 /// number of requests received over the interval of time t_1 to
868 /// t_0+1 with a value of 1.
869 ///
870 /// Note: Even though, when reporting changes since last report time, using
871 /// CUMULATIVE is valid, it is not recommended. This may cause problems for
872 /// systems that do not use start_time to determine when the aggregation
873 /// value was reset (e.g. Prometheus).
874 Cumulative = 2,
875}
876impl AggregationTemporality {
877 /// String value of the enum field names used in the ProtoBuf definition.
878 ///
879 /// The values are not transformed in any way and thus are considered stable
880 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
881 pub fn as_str_name(&self) -> &'static str {
882 match self {
883 Self::Unspecified => "AGGREGATION_TEMPORALITY_UNSPECIFIED",
884 Self::Delta => "AGGREGATION_TEMPORALITY_DELTA",
885 Self::Cumulative => "AGGREGATION_TEMPORALITY_CUMULATIVE",
886 }
887 }
888 /// Creates an enum from field names used in the ProtoBuf definition.
889 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
890 match value {
891 "AGGREGATION_TEMPORALITY_UNSPECIFIED" => Some(Self::Unspecified),
892 "AGGREGATION_TEMPORALITY_DELTA" => Some(Self::Delta),
893 "AGGREGATION_TEMPORALITY_CUMULATIVE" => Some(Self::Cumulative),
894 _ => None,
895 }
896 }
897}
898/// DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a
899/// bit-field representing 32 distinct boolean flags. Each flag defined in this
900/// enum is a bit-mask. To test the presence of a single flag in the flags of
901/// a data point, for example, use an expression like:
902///
903/// (point.flags & DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK) == DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK
904#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
905#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
906#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
907#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
908#[repr(i32)]
909pub enum DataPointFlags {
910 /// The zero value for the enum. Should not be used for comparisons.
911 /// Instead use bitwise "and" with the appropriate mask as shown above.
912 DoNotUse = 0,
913 /// This DataPoint is valid but has no recorded value. This value
914 /// SHOULD be used to reflect explicitly missing data in a series, as
915 /// for an equivalent to the Prometheus "staleness marker".
916 NoRecordedValueMask = 1,
917}
918impl DataPointFlags {
919 /// String value of the enum field names used in the ProtoBuf definition.
920 ///
921 /// The values are not transformed in any way and thus are considered stable
922 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
923 pub fn as_str_name(&self) -> &'static str {
924 match self {
925 Self::DoNotUse => "DATA_POINT_FLAGS_DO_NOT_USE",
926 Self::NoRecordedValueMask => "DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK",
927 }
928 }
929 /// Creates an enum from field names used in the ProtoBuf definition.
930 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
931 match value {
932 "DATA_POINT_FLAGS_DO_NOT_USE" => Some(Self::DoNotUse),
933 "DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK" => Some(Self::NoRecordedValueMask),
934 _ => None,
935 }
936 }
937}