You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/om/open_metrics_spec_2_0.md
+27-19Lines changed: 27 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,48 +40,56 @@ Created in 2012, Prometheus has been the default for cloud-native observability
40
40
41
41
In 2020, [OpenMetrics 1.0](open_metrics_spec.md) was released to clean up and tighten the specification with the additional purpose of bringing it into IETF. OpenMetrics 1.0 text exposition documented a working standard with wide and organic adoption among dozens of exporters, integrations, and ingestors.
42
42
43
-
Around 2024, the OpenMetrics project was incorporated under the CNCF Prometheus project umbrella. Together with production learnings from deploying OpenMetrics 1.0 on wide scale and a backlog of new Prometheus innovations missing from the text formats, Prometheus community decided to pursue a second version of OpenMetrics standard.
43
+
Around 2024, the OpenMetrics project was incorporated under the CNCF Prometheus project umbrella. Together with production learnings from deploying OpenMetrics 1.0 on wide scale and a backlog of new Prometheus innovations missing from the text formats, Prometheus community decided to pursue a second version of the OpenMetrics standard.
44
44
45
-
The intention of OpenMetrics 2.0 is to use OpenMetrics 1.0 as a foundation and enhance it to achieve even greater reliability, usability and consistency with the modern Prometheus data model, without sacrificing the ease of use and readability. See TODO for changes, since the OpenMetrics 1.0.
45
+
The intention of OpenMetrics 2.0 is to use OpenMetrics 1.0 as a foundation and enhance it to achieve even greater reliability, usability and consistency with the modern Prometheus data model, without sacrificing the ease of use and readability. OpenMetrics 2.0 also improves compatibility with OpenTelemetry data model and naming conventions.
46
46
47
-
This document is meant to be used a standalone specification, although the majority of the content is reused from the [OpenMetrics 1.0](open_metrics_spec.md).
47
+
This document is meant to be used as a standalone specification.
48
48
49
-
> NOTE: This document is an early draft, major changes expected. Read [here](https://github.com/prometheus/OpenMetrics/issues/276) on how to join [the Prometheus OM 2.0 work group](https://docs.google.com/document/d/1FCD-38Xz1-9b3ExgHOeDTQUKUatzgj5KbCND9t-abZY/edit?tab=t.lvx6fags1fga#heading=h.uaaplxxbz60u).
49
+
> NOTE: This is a release candidate (RC) version of the OpenMetrics 2.0 specification. This means that this specification is currently in an experimental state--no major changes are expected, but we reserve the right to break the compatibility if it's necessary, based on the early adopters' feedback. The potential feedback, questions and suggestions should be added as [an issue on the `prometheus/openmetrics` repository](https://github.com/prometheus/openmetrics).
50
50
51
51
## Overview
52
52
53
53
Metrics are a specific kind of telemetry data. They represent a snapshot of the current state for a set of data. They are distinct from logs or events, which focus on records or information about individual events.
54
54
55
55
OpenMetrics is primarily a wire format, independent of any particular transport for that format. The format is expected to be consumed on a regular basis and to be meaningful over successive expositions.
56
56
57
-
Implementers MUST expose metrics in the OpenMetrics text format in response to a simple HTTP GET request to a documented URL for a given process or device. This endpoint SHOULD be called "/metrics". Implementers MAY also expose OpenMetrics formatted metrics in other ways, such as by regularly pushing metric sets to an operator-configured endpoint over HTTP.
57
+
Implementers SHOULD expose metrics in the OpenMetrics text format in response to an HTTP GET request to a documented URL for a given process or device. This endpoint SHOULD be called "/metrics". Implementers MAY also expose OpenMetrics formatted metrics in other ways, for example, by regularly pushing metric sets to an operator-configured endpoint over HTTP.
58
58
59
59
### Metrics and Time Series
60
60
61
-
This standard expresses all system states as numerical values; counts, current values, enumerations, and boolean states being common examples. Contrary to metrics, singular events occur at a specific time. Metrics tend to aggregate data temporally. While this can lose information, the reduction in overhead is an engineering trade-off commonly chosen in many modern monitoring systems.
61
+
This standard expresses all system states as numerical values; counts, current values, distributions, enumerations, and boolean states being common examples. Contrary to metrics, singular events occur at a specific time. Metrics tend to aggregate data temporally. While this can lose information, the reduction in overhead is an engineering trade-off commonly chosen in many modern monitoring systems.
62
62
63
-
Time series are a record of changing information over time. While time series can support arbitrary strings or binary data, only numeric data is in scope for this RFC.
64
-
65
-
Common examples of metric time series would be network interface counters, device temperatures, BGP connection states, and alert states.
63
+
Time series are a record of changing information over time. Common examples of metric time series would be network interface counters, device temperatures, BGP connection states, latency distributions, and alert states.
66
64
67
65
## Data Model
68
66
69
-
This section MUST be read together with the ABNF section. In case of disagreements between the two, the ABNF's restrictions MUST take precedence. This reduces repetition as the text wire format MUST be supported.
67
+
This section MUST be read together with the ABNF section. In case of disagreements between the two, the ABNF's restrictions MUST take precedence.
68
+
69
+
// TODO: High level diagram to put here.
70
70
71
71
### Data Types
72
72
73
-
#### Values
73
+
// TODO(dashpole): Fix on Data model redefinition was "Values".
74
+
#### Sample Values
74
75
75
76
Metric values in OpenMetrics MUST be either Number or CompositeValue.
76
77
77
78
##### Number
78
79
80
+
// MAYBE: Clarify floating point exactly / link to where we do this instead of float64
81
+
// MAYBE: "ut it MAY be used to signal a division by zero" -> add or any result of the math operations that would result it in.
79
82
Number value MUST be either floating point or integer. Note that ingestors of the format MAY only support float64. The non-real values NaN, +Inf and -Inf MUST be supported. NaN value MUST NOT be considered a missing value, but it MAY be used to signal a division by zero.
80
83
84
+
Booleans MUST be represented as a Number value where `1` is true and `0` is false.
85
+
81
86
##### CompositeValue
82
87
88
+
// TODO(dashpole): Fix on Data model redefinition "Sample value"
89
+
// * Sample = value + timestamp + st + exemplars
83
90
CompositeValue MUST contain all information necessary to recreate a sample value for Metric within the MetricFamily.
84
91
92
+
// TODO(dashpole): Fix on Data model redefinition "Metric Values" -> maybe "Sample Values"
85
93
The following MetricFamily Types MUST use CompositeValue for Metric Values:
86
94
87
95
*[Histogram](#histogram) MetricFamily Type.
@@ -90,14 +98,9 @@ The following MetricFamily Types MUST use CompositeValue for Metric Values:
90
98
91
99
Other MetricFamily Types MUST use Numbers.
92
100
93
-
See [MetricFamily Types](#metricfamily-types) for details.
94
-
95
-
##### Booleans
96
-
97
-
Boolean values MUST follow `1==true`, `0==false`.
98
-
99
101
#### Timestamps
100
102
103
+
// MAYBE: Mention its float?
101
104
Timestamps MUST be Unix Epoch in seconds. Negative timestamps MAY be used.
102
105
103
106
#### Strings
@@ -110,6 +113,7 @@ Labels are key-value pairs consisting of strings.
110
113
111
114
Label names beginning with two underscores are RESERVED and MUST NOT be used unless specified by this standard. Such Label names MAY be used in place of TYPE and UNIT metadata in cases where MetricFamilies' metadata might otherwise be conflicting, such as metric federation cases.
112
115
116
+
// MAYBE: Link to where we explain "UTF-8 metrics may reduce usability"
113
117
Label names SHOULD follow the restrictions in the ABNF section under the `label-name` section. Label names MAY be any quoted escaped UTF-8 string as described in the ABNF section. Be aware that exposing UTF-8 metrics may reduce usability.
114
118
115
119
Empty label values SHOULD be treated as if the label was not present.
@@ -118,26 +122,30 @@ Empty label values SHOULD be treated as if the label was not present.
118
122
119
123
A LabelSet MUST consist of Labels and MAY be empty. Label names MUST be unique within a LabelSet.
120
124
125
+
// TODO(dashpole): Sample
121
126
#### MetricPoint
122
127
128
+
// TODO(dashpole): Updating... (removed)
123
129
Each MetricPoint consists of a set of values, depending on the MetricFamily Type.
124
130
125
131
#### Exemplars
126
132
127
133
Exemplars are references to data outside of the MetricSet. A common use case are IDs of program traces.
128
134
129
-
Exemplars MUST consist of a LabelSet and a value, and MUST have a timestamp. The LabelSet SHOULD NOT contain any Label names included in the MetricPoint's LabelSet. The timestamp SHOULD NOT be after the MetricPoint's timestamp, if present, and SHOULD NOT be before the MetricPoint's start timestamp, if present.
135
+
Exemplars MUST consist of a LabelSet and a Number value, and MUST have a timestamp. The LabelSet SHOULD NOT contain any Label names included in the MetricPoint's LabelSet. The timestamp SHOULD be before or equal to the MetricPoint's timestamp, if present. The timestamp SHOULD be after or equal to the MetricPoint's start timestamp, if present.
130
136
131
-
The Exemplar's timestamp SHOULD be close to the point in time when the referenced data was created, but doesn't have to be exact. For example if getting an exact timestamp is costly, it is acceptable to use some external source or synthetic clock.
137
+
The Exemplar's timestamp SHOULD be close to the point when it was observed, but doesn't have to be exact. For example, if getting an exact timestamp is costly, it is acceptable to use some external source or an estimate.
132
138
133
139
When an exemplar references a [Trace Context](https://www.w3.org/TR/trace-context-2/), it SHOULD use the `trace_id` key for the [trace-id](https://www.w3.org/TR/trace-context-2/#traceparent-header) field, and the `span_id` key for the [`parent-id`](https://www.w3.org/TR/trace-context-2/#traceparent-header) field.
134
140
135
141
While there's no [hard limit](#size-limits) specified, Exemplar's LabelSet SHOULD NOT be used to transport large data like tracing span details or other event logging.
136
142
143
+
// TODO: "If you truncate data try to preserve trace id and span id"
137
144
Ingestors MAY truncate the Exemplar's LabelSet or discard Exemplars.
138
145
139
146
#### Metric
140
147
148
+
// TODO(dashpole) updating
141
149
Metrics are defined by a unique LabelSet within a MetricFamily. Metrics MUST contain a list of one or more MetricPoints. Metrics with the same name for a given MetricFamily SHOULD have the same set of label names in their LabelSet.
0 commit comments