metrics.proto 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. // Copyright 2019, OpenTelemetry Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package opentelemetry.proto.metrics.v1;
  16. import "opentelemetry/proto/common/v1/common.proto";
  17. import "opentelemetry/proto/resource/v1/resource.proto";
  18. option csharp_namespace = "OpenTelemetry.Proto.Metrics.V1";
  19. option java_multiple_files = true;
  20. option java_package = "io.opentelemetry.proto.metrics.v1";
  21. option java_outer_classname = "MetricsProto";
  22. option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1";
  23. // MetricsData represents the metrics data that can be stored in a persistent
  24. // storage, OR can be embedded by other protocols that transfer OTLP metrics
  25. // data but do not implement the OTLP protocol.
  26. //
  27. // The main difference between this message and collector protocol is that
  28. // in this message there will not be any "control" or "metadata" specific to
  29. // OTLP protocol.
  30. //
  31. // When new fields are added into this message, the OTLP request MUST be updated
  32. // as well.
  33. message MetricsData {
  34. // An array of ResourceMetrics.
  35. // For data coming from a single resource this array will typically contain
  36. // one element. Intermediary nodes that receive data from multiple origins
  37. // typically batch the data before forwarding further and in that case this
  38. // array will contain multiple elements.
  39. repeated ResourceMetrics resource_metrics = 1;
  40. }
  41. // A collection of ScopeMetrics from a Resource.
  42. message ResourceMetrics {
  43. reserved 1000;
  44. // The resource for the metrics in this message.
  45. // If this field is not set then no resource info is known.
  46. opentelemetry.proto.resource.v1.Resource resource = 1;
  47. // A list of metrics that originate from a resource.
  48. repeated ScopeMetrics scope_metrics = 2;
  49. // The Schema URL, if known. This is the identifier of the Schema that the resource data
  50. // is recorded in. To learn more about Schema URL see
  51. // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
  52. // This schema_url applies to the data in the "resource" field. It does not apply
  53. // to the data in the "scope_metrics" field which have their own schema_url field.
  54. string schema_url = 3;
  55. }
  56. // A collection of Metrics produced by an Scope.
  57. message ScopeMetrics {
  58. // The instrumentation scope information for the metrics in this message.
  59. // Semantically when InstrumentationScope isn't set, it is equivalent with
  60. // an empty instrumentation scope name (unknown).
  61. opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
  62. // A list of metrics that originate from an instrumentation library.
  63. repeated Metric metrics = 2;
  64. // The Schema URL, if known. This is the identifier of the Schema that the metric data
  65. // is recorded in. To learn more about Schema URL see
  66. // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
  67. // This schema_url applies to all metrics in the "metrics" field.
  68. string schema_url = 3;
  69. }
  70. // Defines a Metric which has one or more timeseries. The following is a
  71. // brief summary of the Metric data model. For more details, see:
  72. //
  73. // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md
  74. //
  75. //
  76. // The data model and relation between entities is shown in the
  77. // diagram below. Here, "DataPoint" is the term used to refer to any
  78. // one of the specific data point value types, and "points" is the term used
  79. // to refer to any one of the lists of points contained in the Metric.
  80. //
  81. // - Metric is composed of a metadata and data.
  82. // - Metadata part contains a name, description, unit.
  83. // - Data is one of the possible types (Sum, Gauge, Histogram, Summary).
  84. // - DataPoint contains timestamps, attributes, and one of the possible value type
  85. // fields.
  86. //
  87. // Metric
  88. // +------------+
  89. // |name |
  90. // |description |
  91. // |unit | +------------------------------------+
  92. // |data |---> |Gauge, Sum, Histogram, Summary, ... |
  93. // +------------+ +------------------------------------+
  94. //
  95. // Data [One of Gauge, Sum, Histogram, Summary, ...]
  96. // +-----------+
  97. // |... | // Metadata about the Data.
  98. // |points |--+
  99. // +-----------+ |
  100. // | +---------------------------+
  101. // | |DataPoint 1 |
  102. // v |+------+------+ +------+ |
  103. // +-----+ ||label |label |...|label | |
  104. // | 1 |-->||value1|value2|...|valueN| |
  105. // +-----+ |+------+------+ +------+ |
  106. // | . | |+-----+ |
  107. // | . | ||value| |
  108. // | . | |+-----+ |
  109. // | . | +---------------------------+
  110. // | . | .
  111. // | . | .
  112. // | . | .
  113. // | . | +---------------------------+
  114. // | . | |DataPoint M |
  115. // +-----+ |+------+------+ +------+ |
  116. // | M |-->||label |label |...|label | |
  117. // +-----+ ||value1|value2|...|valueN| |
  118. // |+------+------+ +------+ |
  119. // |+-----+ |
  120. // ||value| |
  121. // |+-----+ |
  122. // +---------------------------+
  123. //
  124. // Each distinct type of DataPoint represents the output of a specific
  125. // aggregation function, the result of applying the DataPoint's
  126. // associated function of to one or more measurements.
  127. //
  128. // All DataPoint types have three common fields:
  129. // - Attributes includes key-value pairs associated with the data point
  130. // - TimeUnixNano is required, set to the end time of the aggregation
  131. // - StartTimeUnixNano is optional, but strongly encouraged for DataPoints
  132. // having an AggregationTemporality field, as discussed below.
  133. //
  134. // Both TimeUnixNano and StartTimeUnixNano values are expressed as
  135. // UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
  136. //
  137. // # TimeUnixNano
  138. //
  139. // This field is required, having consistent interpretation across
  140. // DataPoint types. TimeUnixNano is the moment corresponding to when
  141. // the data point's aggregate value was captured.
  142. //
  143. // Data points with the 0 value for TimeUnixNano SHOULD be rejected
  144. // by consumers.
  145. //
  146. // # StartTimeUnixNano
  147. //
  148. // StartTimeUnixNano in general allows detecting when a sequence of
  149. // observations is unbroken. This field indicates to consumers the
  150. // start time for points with cumulative and delta
  151. // AggregationTemporality, and it should be included whenever possible
  152. // to support correct rate calculation. Although it may be omitted
  153. // when the start time is truly unknown, setting StartTimeUnixNano is
  154. // strongly encouraged.
  155. message Metric {
  156. reserved 4, 6, 8;
  157. // name of the metric.
  158. string name = 1;
  159. // description of the metric, which can be used in documentation.
  160. string description = 2;
  161. // unit in which the metric value is reported. Follows the format
  162. // described by http://unitsofmeasure.org/ucum.html.
  163. string unit = 3;
  164. // Data determines the aggregation type (if any) of the metric, what is the
  165. // reported value type for the data points, as well as the relatationship to
  166. // the time interval over which they are reported.
  167. oneof data {
  168. Gauge gauge = 5;
  169. Sum sum = 7;
  170. Histogram histogram = 9;
  171. ExponentialHistogram exponential_histogram = 10;
  172. Summary summary = 11;
  173. }
  174. }
  175. // Gauge represents the type of a scalar metric that always exports the
  176. // "current value" for every data point. It should be used for an "unknown"
  177. // aggregation.
  178. //
  179. // A Gauge does not support different aggregation temporalities. Given the
  180. // aggregation is unknown, points cannot be combined using the same
  181. // aggregation, regardless of aggregation temporalities. Therefore,
  182. // AggregationTemporality is not included. Consequently, this also means
  183. // "StartTimeUnixNano" is ignored for all data points.
  184. message Gauge {
  185. repeated NumberDataPoint data_points = 1;
  186. }
  187. // Sum represents the type of a scalar metric that is calculated as a sum of all
  188. // reported measurements over a time interval.
  189. message Sum {
  190. repeated NumberDataPoint data_points = 1;
  191. // aggregation_temporality describes if the aggregator reports delta changes
  192. // since last report time, or cumulative changes since a fixed start time.
  193. AggregationTemporality aggregation_temporality = 2;
  194. // If "true" means that the sum is monotonic.
  195. bool is_monotonic = 3;
  196. }
  197. // Histogram represents the type of a metric that is calculated by aggregating
  198. // as a Histogram of all reported measurements over a time interval.
  199. message Histogram {
  200. repeated HistogramDataPoint data_points = 1;
  201. // aggregation_temporality describes if the aggregator reports delta changes
  202. // since last report time, or cumulative changes since a fixed start time.
  203. AggregationTemporality aggregation_temporality = 2;
  204. }
  205. // ExponentialHistogram represents the type of a metric that is calculated by aggregating
  206. // as a ExponentialHistogram of all reported double measurements over a time interval.
  207. message ExponentialHistogram {
  208. repeated ExponentialHistogramDataPoint data_points = 1;
  209. // aggregation_temporality describes if the aggregator reports delta changes
  210. // since last report time, or cumulative changes since a fixed start time.
  211. AggregationTemporality aggregation_temporality = 2;
  212. }
  213. // Summary metric data are used to convey quantile summaries,
  214. // a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
  215. // and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45)
  216. // data type. These data points cannot always be merged in a meaningful way.
  217. // While they can be useful in some applications, histogram data points are
  218. // recommended for new applications.
  219. message Summary {
  220. repeated SummaryDataPoint data_points = 1;
  221. }
  222. // AggregationTemporality defines how a metric aggregator reports aggregated
  223. // values. It describes how those values relate to the time interval over
  224. // which they are aggregated.
  225. enum AggregationTemporality {
  226. // UNSPECIFIED is the default AggregationTemporality, it MUST not be used.
  227. AGGREGATION_TEMPORALITY_UNSPECIFIED = 0;
  228. // DELTA is an AggregationTemporality for a metric aggregator which reports
  229. // changes since last report time. Successive metrics contain aggregation of
  230. // values from continuous and non-overlapping intervals.
  231. //
  232. // The values for a DELTA metric are based only on the time interval
  233. // associated with one measurement cycle. There is no dependency on
  234. // previous measurements like is the case for CUMULATIVE metrics.
  235. //
  236. // For example, consider a system measuring the number of requests that
  237. // it receives and reports the sum of these requests every second as a
  238. // DELTA metric:
  239. //
  240. // 1. The system starts receiving at time=t_0.
  241. // 2. A request is received, the system measures 1 request.
  242. // 3. A request is received, the system measures 1 request.
  243. // 4. A request is received, the system measures 1 request.
  244. // 5. The 1 second collection cycle ends. A metric is exported for the
  245. // number of requests received over the interval of time t_0 to
  246. // t_0+1 with a value of 3.
  247. // 6. A request is received, the system measures 1 request.
  248. // 7. A request is received, the system measures 1 request.
  249. // 8. The 1 second collection cycle ends. A metric is exported for the
  250. // number of requests received over the interval of time t_0+1 to
  251. // t_0+2 with a value of 2.
  252. AGGREGATION_TEMPORALITY_DELTA = 1;
  253. // CUMULATIVE is an AggregationTemporality for a metric aggregator which
  254. // reports changes since a fixed start time. This means that current values
  255. // of a CUMULATIVE metric depend on all previous measurements since the
  256. // start time. Because of this, the sender is required to retain this state
  257. // in some form. If this state is lost or invalidated, the CUMULATIVE metric
  258. // values MUST be reset and a new fixed start time following the last
  259. // reported measurement time sent MUST be used.
  260. //
  261. // For example, consider a system measuring the number of requests that
  262. // it receives and reports the sum of these requests every second as a
  263. // CUMULATIVE metric:
  264. //
  265. // 1. The system starts receiving at time=t_0.
  266. // 2. A request is received, the system measures 1 request.
  267. // 3. A request is received, the system measures 1 request.
  268. // 4. A request is received, the system measures 1 request.
  269. // 5. The 1 second collection cycle ends. A metric is exported for the
  270. // number of requests received over the interval of time t_0 to
  271. // t_0+1 with a value of 3.
  272. // 6. A request is received, the system measures 1 request.
  273. // 7. A request is received, the system measures 1 request.
  274. // 8. The 1 second collection cycle ends. A metric is exported for the
  275. // number of requests received over the interval of time t_0 to
  276. // t_0+2 with a value of 5.
  277. // 9. The system experiences a fault and loses state.
  278. // 10. The system recovers and resumes receiving at time=t_1.
  279. // 11. A request is received, the system measures 1 request.
  280. // 12. The 1 second collection cycle ends. A metric is exported for the
  281. // number of requests received over the interval of time t_1 to
  282. // t_0+1 with a value of 1.
  283. //
  284. // Note: Even though, when reporting changes since last report time, using
  285. // CUMULATIVE is valid, it is not recommended. This may cause problems for
  286. // systems that do not use start_time to determine when the aggregation
  287. // value was reset (e.g. Prometheus).
  288. AGGREGATION_TEMPORALITY_CUMULATIVE = 2;
  289. }
  290. // DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a
  291. // bit-field representing 32 distinct boolean flags. Each flag defined in this
  292. // enum is a bit-mask. To test the presence of a single flag in the flags of
  293. // a data point, for example, use an expression like:
  294. //
  295. // (point.flags & DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK) == DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK
  296. //
  297. enum DataPointFlags {
  298. // The zero value for the enum. Should not be used for comparisons.
  299. // Instead use bitwise "and" with the appropriate mask as shown above.
  300. DATA_POINT_FLAGS_DO_NOT_USE = 0;
  301. // This DataPoint is valid but has no recorded value. This value
  302. // SHOULD be used to reflect explicitly missing data in a series, as
  303. // for an equivalent to the Prometheus "staleness marker".
  304. DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1;
  305. // Bits 2-31 are reserved for future use.
  306. }
  307. // NumberDataPoint is a single data point in a timeseries that describes the
  308. // time-varying scalar value of a metric.
  309. message NumberDataPoint {
  310. reserved 1;
  311. // The set of key/value pairs that uniquely identify the timeseries from
  312. // where this point belongs. The list may be empty (may contain 0 elements).
  313. // Attribute keys MUST be unique (it is not allowed to have more than one
  314. // attribute with the same key).
  315. repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
  316. // StartTimeUnixNano is optional but strongly encouraged, see the
  317. // the detailed comments above Metric.
  318. //
  319. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  320. // 1970.
  321. fixed64 start_time_unix_nano = 2;
  322. // TimeUnixNano is required, see the detailed comments above Metric.
  323. //
  324. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  325. // 1970.
  326. fixed64 time_unix_nano = 3;
  327. // The value itself. A point is considered invalid when one of the recognized
  328. // value fields is not present inside this oneof.
  329. oneof value {
  330. double as_double = 4;
  331. sfixed64 as_int = 6;
  332. }
  333. // (Optional) List of exemplars collected from
  334. // measurements that were used to form the data point
  335. repeated Exemplar exemplars = 5;
  336. // Flags that apply to this specific data point. See DataPointFlags
  337. // for the available flags and their meaning.
  338. uint32 flags = 8;
  339. }
  340. // HistogramDataPoint is a single data point in a timeseries that describes the
  341. // time-varying values of a Histogram. A Histogram contains summary statistics
  342. // for a population of values, it may optionally contain the distribution of
  343. // those values across a set of buckets.
  344. //
  345. // If the histogram contains the distribution of values, then both
  346. // "explicit_bounds" and "bucket counts" fields must be defined.
  347. // If the histogram does not contain the distribution of values, then both
  348. // "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
  349. // "sum" are known.
  350. message HistogramDataPoint {
  351. reserved 1;
  352. // The set of key/value pairs that uniquely identify the timeseries from
  353. // where this point belongs. The list may be empty (may contain 0 elements).
  354. // Attribute keys MUST be unique (it is not allowed to have more than one
  355. // attribute with the same key).
  356. repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
  357. // StartTimeUnixNano is optional but strongly encouraged, see the
  358. // the detailed comments above Metric.
  359. //
  360. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  361. // 1970.
  362. fixed64 start_time_unix_nano = 2;
  363. // TimeUnixNano is required, see the detailed comments above Metric.
  364. //
  365. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  366. // 1970.
  367. fixed64 time_unix_nano = 3;
  368. // count is the number of values in the population. Must be non-negative. This
  369. // value must be equal to the sum of the "count" fields in buckets if a
  370. // histogram is provided.
  371. fixed64 count = 4;
  372. // sum of the values in the population. If count is zero then this field
  373. // must be zero.
  374. //
  375. // Note: Sum should only be filled out when measuring non-negative discrete
  376. // events, and is assumed to be monotonic over the values of these events.
  377. // Negative events *can* be recorded, but sum should not be filled out when
  378. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  379. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
  380. optional double sum = 5;
  381. // bucket_counts is an optional field contains the count values of histogram
  382. // for each bucket.
  383. //
  384. // The sum of the bucket_counts must equal the value in the count field.
  385. //
  386. // The number of elements in bucket_counts array must be by one greater than
  387. // the number of elements in explicit_bounds array.
  388. repeated fixed64 bucket_counts = 6;
  389. // explicit_bounds specifies buckets with explicitly defined bounds for values.
  390. //
  391. // The boundaries for bucket at index i are:
  392. //
  393. // (-infinity, explicit_bounds[i]] for i == 0
  394. // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds)
  395. // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds)
  396. //
  397. // The values in the explicit_bounds array must be strictly increasing.
  398. //
  399. // Histogram buckets are inclusive of their upper boundary, except the last
  400. // bucket where the boundary is at infinity. This format is intentionally
  401. // compatible with the OpenMetrics histogram definition.
  402. repeated double explicit_bounds = 7;
  403. // (Optional) List of exemplars collected from
  404. // measurements that were used to form the data point
  405. repeated Exemplar exemplars = 8;
  406. // Flags that apply to this specific data point. See DataPointFlags
  407. // for the available flags and their meaning.
  408. uint32 flags = 10;
  409. // min is the minimum value over (start_time, end_time].
  410. optional double min = 11;
  411. // max is the maximum value over (start_time, end_time].
  412. optional double max = 12;
  413. }
  414. // ExponentialHistogramDataPoint is a single data point in a timeseries that describes the
  415. // time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains
  416. // summary statistics for a population of values, it may optionally contain the
  417. // distribution of those values across a set of buckets.
  418. //
  419. message ExponentialHistogramDataPoint {
  420. // The set of key/value pairs that uniquely identify the timeseries from
  421. // where this point belongs. The list may be empty (may contain 0 elements).
  422. // Attribute keys MUST be unique (it is not allowed to have more than one
  423. // attribute with the same key).
  424. repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
  425. // StartTimeUnixNano is optional but strongly encouraged, see the
  426. // the detailed comments above Metric.
  427. //
  428. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  429. // 1970.
  430. fixed64 start_time_unix_nano = 2;
  431. // TimeUnixNano is required, see the detailed comments above Metric.
  432. //
  433. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  434. // 1970.
  435. fixed64 time_unix_nano = 3;
  436. // count is the number of values in the population. Must be
  437. // non-negative. This value must be equal to the sum of the "bucket_counts"
  438. // values in the positive and negative Buckets plus the "zero_count" field.
  439. fixed64 count = 4;
  440. // sum of the values in the population. If count is zero then this field
  441. // must be zero.
  442. //
  443. // Note: Sum should only be filled out when measuring non-negative discrete
  444. // events, and is assumed to be monotonic over the values of these events.
  445. // Negative events *can* be recorded, but sum should not be filled out when
  446. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  447. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
  448. optional double sum = 5;
  449. // scale describes the resolution of the histogram. Boundaries are
  450. // located at powers of the base, where:
  451. //
  452. // base = (2^(2^-scale))
  453. //
  454. // The histogram bucket identified by `index`, a signed integer,
  455. // contains values that are greater than (base^index) and
  456. // less than or equal to (base^(index+1)).
  457. //
  458. // The positive and negative ranges of the histogram are expressed
  459. // separately. Negative values are mapped by their absolute value
  460. // into the negative range using the same scale as the positive range.
  461. //
  462. // scale is not restricted by the protocol, as the permissible
  463. // values depend on the range of the data.
  464. sint32 scale = 6;
  465. // zero_count is the count of values that are either exactly zero or
  466. // within the region considered zero by the instrumentation at the
  467. // tolerated degree of precision. This bucket stores values that
  468. // cannot be expressed using the standard exponential formula as
  469. // well as values that have been rounded to zero.
  470. //
  471. // Implementations MAY consider the zero bucket to have probability
  472. // mass equal to (zero_count / count).
  473. fixed64 zero_count = 7;
  474. // positive carries the positive range of exponential bucket counts.
  475. Buckets positive = 8;
  476. // negative carries the negative range of exponential bucket counts.
  477. Buckets negative = 9;
  478. // Buckets are a set of bucket counts, encoded in a contiguous array
  479. // of counts.
  480. message Buckets {
  481. // Offset is the bucket index of the first entry in the bucket_counts array.
  482. //
  483. // Note: This uses a varint encoding as a simple form of compression.
  484. sint32 offset = 1;
  485. // bucket_counts is an array of count values, where bucket_counts[i] carries
  486. // the count of the bucket at index (offset+i). bucket_counts[i] is the count
  487. // of values greater than base^(offset+i) and less than or equal to
  488. // base^(offset+i+1).
  489. //
  490. // Note: By contrast, the explicit HistogramDataPoint uses
  491. // fixed64. This field is expected to have many buckets,
  492. // especially zeros, so uint64 has been selected to ensure
  493. // varint encoding.
  494. repeated uint64 bucket_counts = 2;
  495. }
  496. // Flags that apply to this specific data point. See DataPointFlags
  497. // for the available flags and their meaning.
  498. uint32 flags = 10;
  499. // (Optional) List of exemplars collected from
  500. // measurements that were used to form the data point
  501. repeated Exemplar exemplars = 11;
  502. // min is the minimum value over (start_time, end_time].
  503. optional double min = 12;
  504. // max is the maximum value over (start_time, end_time].
  505. optional double max = 13;
  506. // ZeroThreshold may be optionally set to convey the width of the zero
  507. // region. Where the zero region is defined as the closed interval
  508. // [-ZeroThreshold, ZeroThreshold].
  509. // When ZeroThreshold is 0, zero count bucket stores values that cannot be
  510. // expressed using the standard exponential formula as well as values that
  511. // have been rounded to zero.
  512. double zero_threshold = 14;
  513. }
  514. // SummaryDataPoint is a single data point in a timeseries that describes the
  515. // time-varying values of a Summary metric.
  516. message SummaryDataPoint {
  517. reserved 1;
  518. // The set of key/value pairs that uniquely identify the timeseries from
  519. // where this point belongs. The list may be empty (may contain 0 elements).
  520. // Attribute keys MUST be unique (it is not allowed to have more than one
  521. // attribute with the same key).
  522. repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
  523. // StartTimeUnixNano is optional but strongly encouraged, see the
  524. // the detailed comments above Metric.
  525. //
  526. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  527. // 1970.
  528. fixed64 start_time_unix_nano = 2;
  529. // TimeUnixNano is required, see the detailed comments above Metric.
  530. //
  531. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  532. // 1970.
  533. fixed64 time_unix_nano = 3;
  534. // count is the number of values in the population. Must be non-negative.
  535. fixed64 count = 4;
  536. // sum of the values in the population. If count is zero then this field
  537. // must be zero.
  538. //
  539. // Note: Sum should only be filled out when measuring non-negative discrete
  540. // events, and is assumed to be monotonic over the values of these events.
  541. // Negative events *can* be recorded, but sum should not be filled out when
  542. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  543. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary
  544. double sum = 5;
  545. // Represents the value at a given quantile of a distribution.
  546. //
  547. // To record Min and Max values following conventions are used:
  548. // - The 1.0 quantile is equivalent to the maximum value observed.
  549. // - The 0.0 quantile is equivalent to the minimum value observed.
  550. //
  551. // See the following issue for more context:
  552. // https://github.com/open-telemetry/opentelemetry-proto/issues/125
  553. message ValueAtQuantile {
  554. // The quantile of a distribution. Must be in the interval
  555. // [0.0, 1.0].
  556. double quantile = 1;
  557. // The value at the given quantile of a distribution.
  558. //
  559. // Quantile values must NOT be negative.
  560. double value = 2;
  561. }
  562. // (Optional) list of values at different quantiles of the distribution calculated
  563. // from the current snapshot. The quantiles must be strictly increasing.
  564. repeated ValueAtQuantile quantile_values = 6;
  565. // Flags that apply to this specific data point. See DataPointFlags
  566. // for the available flags and their meaning.
  567. uint32 flags = 8;
  568. }
  569. // A representation of an exemplar, which is a sample input measurement.
  570. // Exemplars also hold information about the environment when the measurement
  571. // was recorded, for example the span and trace ID of the active span when the
  572. // exemplar was recorded.
  573. message Exemplar {
  574. reserved 1;
  575. // The set of key/value pairs that were filtered out by the aggregator, but
  576. // recorded alongside the original measurement. Only key/value pairs that were
  577. // filtered out by the aggregator should be included
  578. repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7;
  579. // time_unix_nano is the exact time when this exemplar was recorded
  580. //
  581. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  582. // 1970.
  583. fixed64 time_unix_nano = 2;
  584. // The value of the measurement that was recorded. An exemplar is
  585. // considered invalid when one of the recognized value fields is not present
  586. // inside this oneof.
  587. oneof value {
  588. double as_double = 3;
  589. sfixed64 as_int = 6;
  590. }
  591. // (Optional) Span ID of the exemplar trace.
  592. // span_id may be missing if the measurement is not recorded inside a trace
  593. // or if the trace is not sampled.
  594. bytes span_id = 4;
  595. // (Optional) Trace ID of the exemplar trace.
  596. // trace_id may be missing if the measurement is not recorded inside a trace
  597. // or if the trace is not sampled.
  598. bytes trace_id = 5;
  599. }