metrics.proto 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  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. // Additional metadata attributes that describe the metric. [Optional].
  175. // Attributes are non-identifying.
  176. // Consumers SHOULD NOT need to be aware of these attributes.
  177. // These attributes MAY be used to encode information allowing
  178. // for lossless roundtrip translation to / from another data model.
  179. // Attribute keys MUST be unique (it is not allowed to have more than one
  180. // attribute with the same key).
  181. repeated opentelemetry.proto.common.v1.KeyValue metadata = 12;
  182. }
  183. // Gauge represents the type of a scalar metric that always exports the
  184. // "current value" for every data point. It should be used for an "unknown"
  185. // aggregation.
  186. //
  187. // A Gauge does not support different aggregation temporalities. Given the
  188. // aggregation is unknown, points cannot be combined using the same
  189. // aggregation, regardless of aggregation temporalities. Therefore,
  190. // AggregationTemporality is not included. Consequently, this also means
  191. // "StartTimeUnixNano" is ignored for all data points.
  192. message Gauge {
  193. repeated NumberDataPoint data_points = 1;
  194. }
  195. // Sum represents the type of a scalar metric that is calculated as a sum of all
  196. // reported measurements over a time interval.
  197. message Sum {
  198. repeated NumberDataPoint data_points = 1;
  199. // aggregation_temporality describes if the aggregator reports delta changes
  200. // since last report time, or cumulative changes since a fixed start time.
  201. AggregationTemporality aggregation_temporality = 2;
  202. // If "true" means that the sum is monotonic.
  203. bool is_monotonic = 3;
  204. }
  205. // Histogram represents the type of a metric that is calculated by aggregating
  206. // as a Histogram of all reported measurements over a time interval.
  207. message Histogram {
  208. repeated HistogramDataPoint 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. // ExponentialHistogram represents the type of a metric that is calculated by aggregating
  214. // as a ExponentialHistogram of all reported double measurements over a time interval.
  215. message ExponentialHistogram {
  216. repeated ExponentialHistogramDataPoint data_points = 1;
  217. // aggregation_temporality describes if the aggregator reports delta changes
  218. // since last report time, or cumulative changes since a fixed start time.
  219. AggregationTemporality aggregation_temporality = 2;
  220. }
  221. // Summary metric data are used to convey quantile summaries,
  222. // a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
  223. // and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45)
  224. // data type. These data points cannot always be merged in a meaningful way.
  225. // While they can be useful in some applications, histogram data points are
  226. // recommended for new applications.
  227. message Summary {
  228. repeated SummaryDataPoint data_points = 1;
  229. }
  230. // AggregationTemporality defines how a metric aggregator reports aggregated
  231. // values. It describes how those values relate to the time interval over
  232. // which they are aggregated.
  233. enum AggregationTemporality {
  234. // UNSPECIFIED is the default AggregationTemporality, it MUST not be used.
  235. AGGREGATION_TEMPORALITY_UNSPECIFIED = 0;
  236. // DELTA is an AggregationTemporality for a metric aggregator which reports
  237. // changes since last report time. Successive metrics contain aggregation of
  238. // values from continuous and non-overlapping intervals.
  239. //
  240. // The values for a DELTA metric are based only on the time interval
  241. // associated with one measurement cycle. There is no dependency on
  242. // previous measurements like is the case for CUMULATIVE metrics.
  243. //
  244. // For example, consider a system measuring the number of requests that
  245. // it receives and reports the sum of these requests every second as a
  246. // DELTA metric:
  247. //
  248. // 1. The system starts receiving at time=t_0.
  249. // 2. A request is received, the system measures 1 request.
  250. // 3. A request is received, the system measures 1 request.
  251. // 4. A request is received, the system measures 1 request.
  252. // 5. The 1 second collection cycle ends. A metric is exported for the
  253. // number of requests received over the interval of time t_0 to
  254. // t_0+1 with a value of 3.
  255. // 6. A request is received, the system measures 1 request.
  256. // 7. A request is received, the system measures 1 request.
  257. // 8. The 1 second collection cycle ends. A metric is exported for the
  258. // number of requests received over the interval of time t_0+1 to
  259. // t_0+2 with a value of 2.
  260. AGGREGATION_TEMPORALITY_DELTA = 1;
  261. // CUMULATIVE is an AggregationTemporality for a metric aggregator which
  262. // reports changes since a fixed start time. This means that current values
  263. // of a CUMULATIVE metric depend on all previous measurements since the
  264. // start time. Because of this, the sender is required to retain this state
  265. // in some form. If this state is lost or invalidated, the CUMULATIVE metric
  266. // values MUST be reset and a new fixed start time following the last
  267. // reported measurement time sent MUST be used.
  268. //
  269. // For example, consider a system measuring the number of requests that
  270. // it receives and reports the sum of these requests every second as a
  271. // CUMULATIVE metric:
  272. //
  273. // 1. The system starts receiving at time=t_0.
  274. // 2. A request is received, the system measures 1 request.
  275. // 3. A request is received, the system measures 1 request.
  276. // 4. A request is received, the system measures 1 request.
  277. // 5. The 1 second collection cycle ends. A metric is exported for the
  278. // number of requests received over the interval of time t_0 to
  279. // t_0+1 with a value of 3.
  280. // 6. A request is received, the system measures 1 request.
  281. // 7. A request is received, the system measures 1 request.
  282. // 8. The 1 second collection cycle ends. A metric is exported for the
  283. // number of requests received over the interval of time t_0 to
  284. // t_0+2 with a value of 5.
  285. // 9. The system experiences a fault and loses state.
  286. // 10. The system recovers and resumes receiving at time=t_1.
  287. // 11. A request is received, the system measures 1 request.
  288. // 12. The 1 second collection cycle ends. A metric is exported for the
  289. // number of requests received over the interval of time t_1 to
  290. // t_0+1 with a value of 1.
  291. //
  292. // Note: Even though, when reporting changes since last report time, using
  293. // CUMULATIVE is valid, it is not recommended. This may cause problems for
  294. // systems that do not use start_time to determine when the aggregation
  295. // value was reset (e.g. Prometheus).
  296. AGGREGATION_TEMPORALITY_CUMULATIVE = 2;
  297. }
  298. // DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a
  299. // bit-field representing 32 distinct boolean flags. Each flag defined in this
  300. // enum is a bit-mask. To test the presence of a single flag in the flags of
  301. // a data point, for example, use an expression like:
  302. //
  303. // (point.flags & DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK) == DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK
  304. //
  305. enum DataPointFlags {
  306. // The zero value for the enum. Should not be used for comparisons.
  307. // Instead use bitwise "and" with the appropriate mask as shown above.
  308. DATA_POINT_FLAGS_DO_NOT_USE = 0;
  309. // This DataPoint is valid but has no recorded value. This value
  310. // SHOULD be used to reflect explicitly missing data in a series, as
  311. // for an equivalent to the Prometheus "staleness marker".
  312. DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1;
  313. // Bits 2-31 are reserved for future use.
  314. }
  315. // NumberDataPoint is a single data point in a timeseries that describes the
  316. // time-varying scalar value of a metric.
  317. message NumberDataPoint {
  318. reserved 1;
  319. // The set of key/value pairs that uniquely identify the timeseries from
  320. // where this point belongs. The list may be empty (may contain 0 elements).
  321. // Attribute keys MUST be unique (it is not allowed to have more than one
  322. // attribute with the same key).
  323. repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
  324. // StartTimeUnixNano is optional but strongly encouraged, see the
  325. // the detailed comments above Metric.
  326. //
  327. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  328. // 1970.
  329. fixed64 start_time_unix_nano = 2;
  330. // TimeUnixNano is required, see the detailed comments above Metric.
  331. //
  332. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  333. // 1970.
  334. fixed64 time_unix_nano = 3;
  335. // The value itself. A point is considered invalid when one of the recognized
  336. // value fields is not present inside this oneof.
  337. oneof value {
  338. double as_double = 4;
  339. sfixed64 as_int = 6;
  340. }
  341. // (Optional) List of exemplars collected from
  342. // measurements that were used to form the data point
  343. repeated Exemplar exemplars = 5;
  344. // Flags that apply to this specific data point. See DataPointFlags
  345. // for the available flags and their meaning.
  346. uint32 flags = 8;
  347. }
  348. // HistogramDataPoint is a single data point in a timeseries that describes the
  349. // time-varying values of a Histogram. A Histogram contains summary statistics
  350. // for a population of values, it may optionally contain the distribution of
  351. // those values across a set of buckets.
  352. //
  353. // If the histogram contains the distribution of values, then both
  354. // "explicit_bounds" and "bucket counts" fields must be defined.
  355. // If the histogram does not contain the distribution of values, then both
  356. // "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
  357. // "sum" are known.
  358. message HistogramDataPoint {
  359. reserved 1;
  360. // The set of key/value pairs that uniquely identify the timeseries from
  361. // where this point belongs. The list may be empty (may contain 0 elements).
  362. // Attribute keys MUST be unique (it is not allowed to have more than one
  363. // attribute with the same key).
  364. repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
  365. // StartTimeUnixNano is optional but strongly encouraged, see the
  366. // the detailed comments above Metric.
  367. //
  368. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  369. // 1970.
  370. fixed64 start_time_unix_nano = 2;
  371. // TimeUnixNano is required, see the detailed comments above Metric.
  372. //
  373. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  374. // 1970.
  375. fixed64 time_unix_nano = 3;
  376. // count is the number of values in the population. Must be non-negative. This
  377. // value must be equal to the sum of the "count" fields in buckets if a
  378. // histogram is provided.
  379. fixed64 count = 4;
  380. // sum of the values in the population. If count is zero then this field
  381. // must be zero.
  382. //
  383. // Note: Sum should only be filled out when measuring non-negative discrete
  384. // events, and is assumed to be monotonic over the values of these events.
  385. // Negative events *can* be recorded, but sum should not be filled out when
  386. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  387. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
  388. optional double sum = 5;
  389. // bucket_counts is an optional field contains the count values of histogram
  390. // for each bucket.
  391. //
  392. // The sum of the bucket_counts must equal the value in the count field.
  393. //
  394. // The number of elements in bucket_counts array must be by one greater than
  395. // the number of elements in explicit_bounds array.
  396. repeated fixed64 bucket_counts = 6;
  397. // explicit_bounds specifies buckets with explicitly defined bounds for values.
  398. //
  399. // The boundaries for bucket at index i are:
  400. //
  401. // (-infinity, explicit_bounds[i]] for i == 0
  402. // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds)
  403. // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds)
  404. //
  405. // The values in the explicit_bounds array must be strictly increasing.
  406. //
  407. // Histogram buckets are inclusive of their upper boundary, except the last
  408. // bucket where the boundary is at infinity. This format is intentionally
  409. // compatible with the OpenMetrics histogram definition.
  410. repeated double explicit_bounds = 7;
  411. // (Optional) List of exemplars collected from
  412. // measurements that were used to form the data point
  413. repeated Exemplar exemplars = 8;
  414. // Flags that apply to this specific data point. See DataPointFlags
  415. // for the available flags and their meaning.
  416. uint32 flags = 10;
  417. // min is the minimum value over (start_time, end_time].
  418. optional double min = 11;
  419. // max is the maximum value over (start_time, end_time].
  420. optional double max = 12;
  421. }
  422. // ExponentialHistogramDataPoint is a single data point in a timeseries that describes the
  423. // time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains
  424. // summary statistics for a population of values, it may optionally contain the
  425. // distribution of those values across a set of buckets.
  426. //
  427. message ExponentialHistogramDataPoint {
  428. // The set of key/value pairs that uniquely identify the timeseries from
  429. // where this point belongs. The list may be empty (may contain 0 elements).
  430. // Attribute keys MUST be unique (it is not allowed to have more than one
  431. // attribute with the same key).
  432. repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
  433. // StartTimeUnixNano is optional but strongly encouraged, see the
  434. // the detailed comments above Metric.
  435. //
  436. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  437. // 1970.
  438. fixed64 start_time_unix_nano = 2;
  439. // TimeUnixNano is required, see the detailed comments above Metric.
  440. //
  441. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  442. // 1970.
  443. fixed64 time_unix_nano = 3;
  444. // count is the number of values in the population. Must be
  445. // non-negative. This value must be equal to the sum of the "bucket_counts"
  446. // values in the positive and negative Buckets plus the "zero_count" field.
  447. fixed64 count = 4;
  448. // sum of the values in the population. If count is zero then this field
  449. // must be zero.
  450. //
  451. // Note: Sum should only be filled out when measuring non-negative discrete
  452. // events, and is assumed to be monotonic over the values of these events.
  453. // Negative events *can* be recorded, but sum should not be filled out when
  454. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  455. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
  456. optional double sum = 5;
  457. // scale describes the resolution of the histogram. Boundaries are
  458. // located at powers of the base, where:
  459. //
  460. // base = (2^(2^-scale))
  461. //
  462. // The histogram bucket identified by `index`, a signed integer,
  463. // contains values that are greater than (base^index) and
  464. // less than or equal to (base^(index+1)).
  465. //
  466. // The positive and negative ranges of the histogram are expressed
  467. // separately. Negative values are mapped by their absolute value
  468. // into the negative range using the same scale as the positive range.
  469. //
  470. // scale is not restricted by the protocol, as the permissible
  471. // values depend on the range of the data.
  472. sint32 scale = 6;
  473. // zero_count is the count of values that are either exactly zero or
  474. // within the region considered zero by the instrumentation at the
  475. // tolerated degree of precision. This bucket stores values that
  476. // cannot be expressed using the standard exponential formula as
  477. // well as values that have been rounded to zero.
  478. //
  479. // Implementations MAY consider the zero bucket to have probability
  480. // mass equal to (zero_count / count).
  481. fixed64 zero_count = 7;
  482. // positive carries the positive range of exponential bucket counts.
  483. Buckets positive = 8;
  484. // negative carries the negative range of exponential bucket counts.
  485. Buckets negative = 9;
  486. // Buckets are a set of bucket counts, encoded in a contiguous array
  487. // of counts.
  488. message Buckets {
  489. // Offset is the bucket index of the first entry in the bucket_counts array.
  490. //
  491. // Note: This uses a varint encoding as a simple form of compression.
  492. sint32 offset = 1;
  493. // bucket_counts is an array of count values, where bucket_counts[i] carries
  494. // the count of the bucket at index (offset+i). bucket_counts[i] is the count
  495. // of values greater than base^(offset+i) and less than or equal to
  496. // base^(offset+i+1).
  497. //
  498. // Note: By contrast, the explicit HistogramDataPoint uses
  499. // fixed64. This field is expected to have many buckets,
  500. // especially zeros, so uint64 has been selected to ensure
  501. // varint encoding.
  502. repeated uint64 bucket_counts = 2;
  503. }
  504. // Flags that apply to this specific data point. See DataPointFlags
  505. // for the available flags and their meaning.
  506. uint32 flags = 10;
  507. // (Optional) List of exemplars collected from
  508. // measurements that were used to form the data point
  509. repeated Exemplar exemplars = 11;
  510. // min is the minimum value over (start_time, end_time].
  511. optional double min = 12;
  512. // max is the maximum value over (start_time, end_time].
  513. optional double max = 13;
  514. // ZeroThreshold may be optionally set to convey the width of the zero
  515. // region. Where the zero region is defined as the closed interval
  516. // [-ZeroThreshold, ZeroThreshold].
  517. // When ZeroThreshold is 0, zero count bucket stores values that cannot be
  518. // expressed using the standard exponential formula as well as values that
  519. // have been rounded to zero.
  520. double zero_threshold = 14;
  521. }
  522. // SummaryDataPoint is a single data point in a timeseries that describes the
  523. // time-varying values of a Summary metric.
  524. message SummaryDataPoint {
  525. reserved 1;
  526. // The set of key/value pairs that uniquely identify the timeseries from
  527. // where this point belongs. The list may be empty (may contain 0 elements).
  528. // Attribute keys MUST be unique (it is not allowed to have more than one
  529. // attribute with the same key).
  530. repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
  531. // StartTimeUnixNano is optional but strongly encouraged, see the
  532. // the detailed comments above Metric.
  533. //
  534. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  535. // 1970.
  536. fixed64 start_time_unix_nano = 2;
  537. // TimeUnixNano is required, see the detailed comments above Metric.
  538. //
  539. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  540. // 1970.
  541. fixed64 time_unix_nano = 3;
  542. // count is the number of values in the population. Must be non-negative.
  543. fixed64 count = 4;
  544. // sum of the values in the population. If count is zero then this field
  545. // must be zero.
  546. //
  547. // Note: Sum should only be filled out when measuring non-negative discrete
  548. // events, and is assumed to be monotonic over the values of these events.
  549. // Negative events *can* be recorded, but sum should not be filled out when
  550. // doing so. This is specifically to enforce compatibility w/ OpenMetrics,
  551. // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary
  552. double sum = 5;
  553. // Represents the value at a given quantile of a distribution.
  554. //
  555. // To record Min and Max values following conventions are used:
  556. // - The 1.0 quantile is equivalent to the maximum value observed.
  557. // - The 0.0 quantile is equivalent to the minimum value observed.
  558. //
  559. // See the following issue for more context:
  560. // https://github.com/open-telemetry/opentelemetry-proto/issues/125
  561. message ValueAtQuantile {
  562. // The quantile of a distribution. Must be in the interval
  563. // [0.0, 1.0].
  564. double quantile = 1;
  565. // The value at the given quantile of a distribution.
  566. //
  567. // Quantile values must NOT be negative.
  568. double value = 2;
  569. }
  570. // (Optional) list of values at different quantiles of the distribution calculated
  571. // from the current snapshot. The quantiles must be strictly increasing.
  572. repeated ValueAtQuantile quantile_values = 6;
  573. // Flags that apply to this specific data point. See DataPointFlags
  574. // for the available flags and their meaning.
  575. uint32 flags = 8;
  576. }
  577. // A representation of an exemplar, which is a sample input measurement.
  578. // Exemplars also hold information about the environment when the measurement
  579. // was recorded, for example the span and trace ID of the active span when the
  580. // exemplar was recorded.
  581. message Exemplar {
  582. reserved 1;
  583. // The set of key/value pairs that were filtered out by the aggregator, but
  584. // recorded alongside the original measurement. Only key/value pairs that were
  585. // filtered out by the aggregator should be included
  586. repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7;
  587. // time_unix_nano is the exact time when this exemplar was recorded
  588. //
  589. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
  590. // 1970.
  591. fixed64 time_unix_nano = 2;
  592. // The value of the measurement that was recorded. An exemplar is
  593. // considered invalid when one of the recognized value fields is not present
  594. // inside this oneof.
  595. oneof value {
  596. double as_double = 3;
  597. sfixed64 as_int = 6;
  598. }
  599. // (Optional) Span ID of the exemplar trace.
  600. // span_id may be missing if the measurement is not recorded inside a trace
  601. // or if the trace is not sampled.
  602. bytes span_id = 4;
  603. // (Optional) Trace ID of the exemplar trace.
  604. // trace_id may be missing if the measurement is not recorded inside a trace
  605. // or if the trace is not sampled.
  606. bytes trace_id = 5;
  607. }