Skip to content

Commit 0badf83

Browse files
committed
update
Signed-off-by: bwplotka <bwplotka@gmail.com>
1 parent bb00485 commit 0badf83

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,34 +157,37 @@ A MetricFamily MAY have zero or more Metrics. Every Metric within a MetricFamily
157157
MetricFamily name:
158158

159159
* MUST be string.
160+
// TODO give example of unknown metadata? No meta exposed, two differently name metric families.
160161
* MUST be unique within a MetricSet.
161162
* MUST be the same as every Metric's Name in the family.
162163

163-
> NOTE: [OpenMetrics 1.0](https://prometheus.io/docs/specs/om/open_metrics_spec/#suffixes) required mandatory suffixes for MetricName and matching MetricFamily names without such suffixes. To improve parser reliability (i.e. matching [MetricFamily metadata](#metricfamily-metadata)) and future compatibility, this specification requires MetricFamily name to strictly match MetricNames in the same family.
164+
> NOTE: [OpenMetrics 1.0](https://prometheus.io/docs/specs/om/open_metrics_spec/#suffixes) required mandatory suffixes for MetricName and matching MetricFamily names without such suffixes. To improve parser reliability (i.e. matching [MetricFamily metadata](#metricfamily-metadata)) and future compatibility, this specification requires Metric name to strictly match its MetricFamily name.
164165
165166
Names SHOULD be in snake_case. Names SHOULD follow the restrictions in the ABNF section under `metricname`. MetricFamily names MAY be any quoted and escaped UTF-8 string as described in the ABNF section. Be aware that exposing UTF-8 metrics may reduce usability, especially when `_total` or unit suffixes are not included in the names.
166167

167168
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.
168169

170+
// CHECK: RESERVED in RFC?
169171
MetricFamily names beginning with underscores are RESERVED and MUST NOT be used unless specified by this standard.
170172

171-
###### Reserved Suffixes
173+
###### Discouraged Suffixes
172174

173-
MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically, a name SHOULD NOT create a MetricName collision when converted to [the Text OpenMetrics 1.0](https://prometheus.io/docs/specs/om/open_metrics_spec). Ingestors MAY reject such MetricFamily.
175+
// TODO: Double check scrape failure modes e.g. rejection MetricSet vs Sample/MetricFamily.
176+
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.
174177

175178
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.
176179

177-
> This rule exists because this specification is following a shift in Prometheus ecosystem towards [composite values](#compositevalues) instead of [the "classic" representation](https://prometheus.io/docs/specs/om/open_metrics_spec/#histogram-1). However, this transformation will take time. Reserving suffixes improves compatibility with older ingestors and the eventual migration process.
180+
> This rule exists because this specification is following a shift in Prometheus ecosystem towards [composite values](#compositevalues) instead of [the "classic" representation](https://prometheus.io/docs/specs/om/open_metrics_spec/#histogram-1). However, this transformation will take time. Avoiding such suffixes improves compatibility with older ingestors and the eventual migration process.
178181
179182
##### Type
180183

181-
Type specifies the MetricFamily Type. Valid values are "unknown", "gauge", "counter", "stateset", "info", "histogram", "gaugehistogram", and "summary".
184+
Type specifies the MetricFamily type. Valid values are "unknown", "gauge", "counter", "stateset", "info", "histogram", "gaugehistogram", and "summary".
182185

183186
##### Unit
184187

185-
Unit specifies MetricFamily units. If non-empty, it SHOULD be a suffix of the MetricFamily name separated by an underscore. Be aware that further generation rules might make it an infix in the text format.
188+
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.
186189

187-
Be aware that 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.
190+
// TODO: Add link to unit value semantics?
188191

189192
##### Help
190193

@@ -198,7 +201,8 @@ Each MetricFamily name MUST be unique. The same label name and value SHOULD NOT
198201

199202
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.
200203

201-
If present, an Info MetricFamily called "target_info" per the "Supporting target metadata in both push-based and pull-based systems" section below SHOULD be first.
204+
// MAYBE: What about other info metrics?
205+
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.
202206

203207
### MetricFamily Types
204208

@@ -210,19 +214,16 @@ A Sample in a Metric with the Type gauge MUST have a Number value.
210214

211215
Gauges MAY increase, decrease, or stay constant over time. Even if they only ever go in one direction, they might still be gauges and not counters. The size of a log file would usually only increase, a resource might decrease, and the limit of a queue size may be constant.
212216

213-
A gauge MAY be used to encode an enum where the enum has many states and changes over time, it is the most efficient but least user friendly.
214-
215217
#### Counter
216218

217219
Counters measure discrete events. Common examples are the number of HTTP requests received, CPU seconds spent, or bytes sent. For counters how quickly they are increasing over time is what is of interest to a user.
218220

219-
The MetricFamily name for Counters SHOULD end in `_total`. Be aware that exposing metrics without `_total` being a suffix of the MetricFamily name directly to end-users may reduce the usability due to confusion about what the metric's Type is.
220-
221-
A Sample in a Metric with the Type Counter MUST have a Number value. The value MUST be a non-NaN and MUST be monotonically non-decreasing over time, starting from 0.
221+
The MetricFamily name for Counters SHOULD end in `_total`. Exposing metrics without a `_total` suffix may reduce the usability due to confusion about what the metric's Type is.
222222

223223
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.
224224

225-
A Sample in a Metric with the type Counter MAY reset its value to 0. If present, the corresponding Start Timestamp MUST also be set to the timestamp of the reset.
225+
// DISCUSSION: If you reset you must set ST?
226+
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, starting 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.
226227

227228
A Sample in a Metric with the type Counter MAY have exemplars.
228229

@@ -248,6 +249,7 @@ Info metrics are used to expose textual information which SHOULD NOT change duri
248249

249250
The MetricFamily name for Info metrics MUST end in `_info`.
250251

252+
// TODO: adjust as per https://github.com/prometheus/docs/pull/2894/changes#r2940458234
251253
Info MAY be used to encode ENUMs whose values do not change over time, such as the type of a network interface.
252254

253255
MetricFamilies of Type Info MUST have an empty Unit string.

0 commit comments

Comments
 (0)