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
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@ Time series are a record of changing information over time. Common examples of m
64
64
65
65
## Data Model
66
66
67
+
// TODO: High level diagram to put here.
67
68
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
69
70
### Data Types
@@ -74,14 +75,19 @@ Metric values in OpenMetrics MUST be either Number or CompositeValue.
74
75
75
76
##### Number
76
77
78
+
// MAYBE: Clarify floating point exactly / link to where we do this instead of float64
79
+
// 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.
77
80
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.
78
81
79
82
Booleans MUST be represented as a Number value where `1` is true and `0` is false.
80
83
81
84
##### CompositeValue
82
85
86
+
// TODO(dashpole): Fix on Data model redefinition "Sample value"
87
+
// * Sample = value + timestamp + st + exemplars
83
88
CompositeValue MUST contain all information necessary to recreate a sample value for Metric within the MetricFamily.
84
89
90
+
// TODO(dashpole): Fix on Data model redefinition "Metric Values" -> maybe "Sample Values"
85
91
The following MetricFamily Types MUST use CompositeValue for Metric Values:
86
92
87
93
*[Histogram](#histogram) MetricFamily Type.
@@ -92,6 +98,7 @@ Other MetricFamily Types MUST use Numbers.
92
98
93
99
#### Timestamps
94
100
101
+
// MAYBE: Mention its float?
95
102
Timestamps MUST be Unix Epoch in seconds. Negative timestamps MAY be used.
96
103
97
104
#### Strings
@@ -104,6 +111,7 @@ Labels are key-value pairs consisting of strings.
104
111
105
112
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.
106
113
114
+
// MAYBE: Link to where we explain "UTF-8 metrics may reduce usability"
107
115
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.
108
116
109
117
Empty label values SHOULD be treated as if the label was not present.
@@ -124,6 +132,7 @@ When an exemplar references a [Trace Context](https://www.w3.org/TR/trace-contex
124
132
125
133
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.
126
134
135
+
// TODO: "If you truncate data try to preserve trace id and span id"
127
136
Ingestors MAY truncate the Exemplar's LabelSet or discard Exemplars.
128
137
129
138
#### Sample
@@ -147,6 +156,7 @@ A MetricFamily MAY have zero or more Metrics. Every Metric within a MetricFamily
147
156
MetricFamily name:
148
157
149
158
* MUST be string.
159
+
// TODO give example of unknown metadata? No meta exposed, two differently name metric families.
150
160
* MUST be unique within a MetricSet.
151
161
* MUST be the same as every Metric's Name in the family.
152
162
@@ -156,10 +166,12 @@ Names SHOULD be in snake_case. Names SHOULD follow the restrictions in the ABNF
156
166
157
167
Colons in MetricFamily names are RESERVED to signal that the MetricFamily is the result of a calculation or aggregation of a general purpose monitoring system.
158
168
169
+
// CHECK: RESERVED in RFC?
159
170
MetricFamily names beginning with underscores are RESERVED and MUST NOT be used unless specified by this standard.
160
171
161
172
###### Discouraged Suffixes
162
173
174
+
// TODO: Double check scrape failure modes e.g. rejection MetricSet vs Sample/MetricFamily.
163
175
MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically, a name SHOULD NOT create a MetricName collision when converted to [the OpenMetrics 1.0 Text](https://prometheus.io/docs/specs/om/open_metrics_spec). Ingestors MAY reject such MetricFamily.
164
176
165
177
A non-compliant example would be a gauge called `foo_bucket` and a histogram called `foo`. Exposers negotiating the older OpenMetrics or Text formats, or ingestors which support only the older data model could end up storing the `foo` histogram in the classic representation (`foo_bucket`, `foo_count`, `foo_sum`), which would clash with the gauge and cause a scrape rejection or dropped data.
@@ -174,6 +186,8 @@ Type specifies the MetricFamily type. Valid values are "unknown", "gauge", "coun
174
186
175
187
Unit specifies MetricFamily units. If non-empty, it SHOULD be a suffix of the MetricFamily name separated by an underscore. Further type specific suffixes come after the unit suffix. Exposing metrics without the unit being a suffix of the MetricFamily name directly to end-users may reduce the usability due to confusion about what the metric's unit is.
176
188
189
+
// TODO: Add link to unit value semantics?
190
+
177
191
##### Help
178
192
179
193
Help is a string and SHOULD be non-empty. It is used to give a brief description of the MetricFamily for human consumption and SHOULD be short enough to be used as a tooltip.
@@ -186,6 +200,7 @@ Each MetricFamily name MUST be unique. The same label name and value SHOULD NOT
186
200
187
201
There is no specific ordering of MetricFamilies required within a MetricSet. An exposer MAY make an exposition easier to read for humans, for example sort alphabetically if the performance tradeoff makes sense.
188
202
203
+
// MAYBE: What about other info metrics?
189
204
If present, an Info MetricFamily called "target_info" per the [Supporting target metadata in both push-based and pull-based systems](#supporting-target-metadata-in-both-push-based-and-pull-based-systems) section below SHOULD be first.
190
205
191
206
### MetricFamily Types
@@ -206,6 +221,7 @@ The MetricFamily name for Counters SHOULD end in `_total`. Exposing metrics with
206
221
207
222
A Sample in a Metric with the Type Counter SHOULD have a Timestamp value called Start Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before.
208
223
224
+
// DISCUSSION: If you reset you must set ST?
209
225
A Sample in a Metric with the Type Counter MUST have a Number value which is non-NaN. The value MUST be monotonically non-decreasing over time, unless it is reset to 0, and start from 0. The value MAY reset its value to 0. If present, the corresponding Start Timestamp MUST also be set to the timestamp of the reset.
210
226
211
227
A Sample in a Metric with the type Counter MAY have exemplars.
@@ -232,6 +248,7 @@ Info metrics are used to expose textual information which SHOULD NOT change duri
232
248
233
249
The MetricFamily name for Info metrics MUST end in `_info`.
234
250
251
+
// TODO: adjust as per https://github.com/prometheus/docs/pull/2894/changes#r2940458234
235
252
Info MAY be used to encode ENUMs whose values do not change over time, such as the type of a network interface.
236
253
237
254
MetricFamilies of Type Info MUST have an empty Unit string.
0 commit comments