Skip to content

Commit 519f7e5

Browse files
dashpolebwplotka
andauthored
Apply suggestions from code review
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com> Signed-off-by: David Ashpole <dashpole@google.com>
1 parent 4c240ac commit 519f7e5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,17 @@ Ingestors MAY truncate the Exemplar's LabelSet or discard Exemplars.
134134

135135
#### Sample
136136

137-
A Sample is a single data point within a Metric. It consists of a Value, an optional timestamp, and may include Exemplars or a start timestamp depending on the MetricFamily Type.
137+
A Sample is a single data point within a Metric. It MUST have a Value, MAY have a Timestamp. It MAY include Exemplars and MAY have a start timestamp, depending on the MetricFamily Type.
138138

139139
Samples SHOULD NOT have explicit timestamps.
140140

141141
If more than one Sample is exposed for a Metric, then its Samples MUST have monotonically increasing timestamps.
142142

143143
#### Metric
144144

145-
Metrics are defined by a unique LabelSet within a MetricFamily. Metrics MUST contain a list of one or more Samples. Metrics with the same name for a given MetricFamily SHOULD have the same set of label names in their LabelSet.
145+
Metrics are defined by a unique LabelSet within a MetricFamily. Metrics MUST contain a list of one or more Samples. If more than one Sample is exposed for a Metric, then its Samples MUST have monotonically increasing Timestamps.
146+
147+
Metrics with the same name for a given MetricFamily SHOULD have the same set of label names in their LabelSet.
146148

147149
#### MetricFamily
148150

@@ -226,11 +228,11 @@ A Sample in a Metric with the type Counter MAY have exemplars.
226228

227229
StateSets represent a series of related boolean values, also called a bitset. If ENUMs need to be encoded this MAY be done via StateSet.
228230

229-
A StateSet is structured as a set of Metrics, one for each State, called a StateSet MetricGroup.
231+
A StateSet is structured as a set of Metrics, one for each state, called a StateSet MetricGroup.
230232

231-
> NOTE: In OpenMetrics 1.0, Metrics are composed of MetricPoints (e.g. A Histogram metric has a MetricPoint representing each Bucket with a special "le" label), which is no longer the case in OpenMetrics 2.0. An OpenMetrics 1.0 StateSet Metric is equivalent to an OpenMetrics 2.0 StateSet MetricGroup, and an OpenMetrics 1.0 StateSet MetricPoint is equivalent to an OpenMetrics 2.0 StateSet Metric.
233+
> NOTE: In OpenMetrics 1.0, Metrics are composed of MetricPoints (e.g. a Histogram metric has a MetricPoint representing each Bucket with a special "le" label), which is no longer the case in OpenMetrics 2.0. An OpenMetrics 1.0 StateSet Metric is equivalent to an OpenMetrics 2.0 StateSet MetricGroup, and an OpenMetrics 1.0 StateSet MetricPoint is equivalent to an OpenMetrics 2.0 StateSet Metric.
232234
233-
A StateSet MetricGroup contains one or more states and MUST contain one boolean per State. States have a name which is a String.
235+
A StateSet MetricGroup contains one or more states and MUST contain one boolean per state. States have a name which is a String.
234236

235237
If encoded as a StateSet, ENUMs MUST have exactly one Sample which is `1` (true) within a MetricGroup.
236238

@@ -252,7 +254,7 @@ MetricFamilies of Type Info MUST have an empty Unit string.
252254

253255
Histograms measure distributions of discrete events. Common examples are the latency of HTTP requests, function runtimes, or I/O request sizes.
254256

255-
A Histogram Sample's Composite Value MUST contain Count and Sum values.
257+
A Histogram Sample MUST contain Count and Sum.
256258

257259
The Count value MUST be equal to the number of measurements taken by the Histogram. The Count is a counter semantically. The Count SHOULD be an integer. The Count MUST NOT be negative. The Count SHOULD NOT be +Inf, NaN.
258260

@@ -834,7 +836,7 @@ There are no recommended suffixes for the MetricFamily name for a MetricFamily o
834836

835837
StateSet MetricGroups MUST NOT be interleaved.
836838

837-
StateSets MUST have one Metric per State in the StateSet MetricGroup. Each State's Metric MUST have a label with the MetricFamily name as the label name and the State name as the label value. The Metric Sample's Value MUST be 1 if the State is true and MUST be 0 if the State is false.
839+
StateSets MUST have one Metric per state in the StateSet MetricGroup. Each state's Metric MUST have a label with the MetricFamily name as the label name and the state name as the label value. The Metric Sample's Value MUST be 1 if the state is true and MUST be 0 if the state is false.
838840

839841
An example with the states "a", "bb", and "ccc" in which only the value bb is enabled and the metric name is foo:
840842

@@ -1110,7 +1112,7 @@ Metrics and samples SHOULD NOT appear and disappear from exposition to expositio
11101112

11111113
In general changing a MetricFamily's Type, or adding or removing a label from its Metrics will be breaking to ingestors.
11121114

1113-
A notable exception is that adding a label to the value of an Info Metric is not breaking. This is so that you can add additional information to an existing Info MetricFamily where it makes sense to be, rather than being forced to create a brand new info metric with an additional label value. ingestor systems should ensure that they are resilient to such additions.
1115+
A notable exception is that adding a label to an Info Metric is not breaking. This is so that you can add additional information to an existing Info MetricFamily where it makes sense to be, rather than being forced to create a brand new info metric with an additional label value. Ingestor systems should ensure that they are resilient to such additions.
11141116

11151117
Changing a MetricFamily's Help is not breaking. For values where it is possible, switching between floats and ints is not breaking. Adding a new state to a stateset is not breaking. Adding unit metadata where it doesn't change the metric name is not breaking.
11161118

0 commit comments

Comments
 (0)