Skip to content

Commit c1aed15

Browse files
committed
restore examples
1 parent d071fca commit c1aed15

1 file changed

Lines changed: 45 additions & 4 deletions

File tree

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,9 @@ Aside from this metadata and the EOF line at the end of the message, you MUST NO
705705

706706
#### Metric
707707

708-
Metrics MUST NOT be interleaved.
708+
Metrics MUST NOT be interleaved. See the example in "Text format -> Metric types -> StateSet".
709709

710-
See the example in "Text format -> Sample". Labels A Sample without labels or a timestamp and the value 0 MUST be rendered either like:
710+
A Sample without labels or a timestamp and the value 0 MUST be rendered either like:
711711

712712
```openmetrics-add-eof
713713
bar_seconds_count 0
@@ -834,8 +834,6 @@ foo_total 17.0 1520879607.789 st@1520430000.123 # {trace_id="KOO5S4vxi0o"} 0.67
834834

835835
There are no recommended suffixes for the MetricFamily name for a MetricFamily of Type StateSet.
836836

837-
StateSet MetricGroups MUST NOT be interleaved.
838-
839837
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.
840838

841839
An example with the states "a", "bb", and "ccc" in which only the value bb is enabled and the metric name is foo:
@@ -859,6 +857,49 @@ foo{entity="replica",foo="bb"} 0.0
859857
foo{entity="replica",foo="ccc"} 1.0
860858
```
861859

860+
StateSet MetricGroups MUST NOT be interleaved.
861+
862+
A correct example where there are multiple MetricGroups within a MetricFamily, and multiple Metrics within each MetricGroup:
863+
864+
```openmetrics-add-eof
865+
# TYPE foo stateset
866+
foo{entity="controller",foo="a"} 1.0
867+
foo{entity="controller",foo="bb"} 0.0
868+
foo{entity="controller",foo="ccc"} 0.0
869+
foo{entity="replica",foo="a"} 1.0
870+
foo{entity="replica",foo="bb"} 0.0
871+
foo{entity="replica",foo="ccc"} 1.0
872+
```
873+
874+
An incorrect example where MetricGroups are interleaved:
875+
876+
```openmetrics-add-eof
877+
# TYPE foo stateset
878+
foo{entity="controller",env="dev",foo="a"} 1.0
879+
foo{entity="controller",env="dev",foo="bb"} 0.0
880+
foo{entity="controller",env="dev",foo="ccc"} 0.0
881+
foo{entity="replica",env="dev",foo="a"} 1.0
882+
foo{entity="replica",env="dev",foo="bb"} 0.0
883+
foo{entity="replica",env="dev",foo="ccc"} 1.0
884+
foo{entity="controller",env="prod",foo="a"} 1.0
885+
foo{entity="controller",env="prod",foo="bb"} 0.0
886+
foo{entity="controller",env="prod",foo="ccc"} 0.0
887+
```
888+
889+
An incorrect example where Metrics are interleaved:
890+
891+
```openmetrics-add-eof
892+
# TYPE foo_seconds summary
893+
# UNIT foo_seconds seconds
894+
# TYPE foo stateset
895+
foo{entity="controller",env="dev",foo="a"} 1.0
896+
foo{entity="controller",env="dev",foo="bb"} 0.0
897+
foo{entity="controller",env="prod",foo="a"} 1.0
898+
foo{entity="controller",env="dev",foo="ccc"} 0.0
899+
foo{entity="controller",env="prod",foo="bb"} 0.0
900+
foo{entity="controller",env="prod",foo="ccc"} 0.0
901+
```
902+
862903
#### Info
863904

864905
The Sample value MUST always be 1.

0 commit comments

Comments
 (0)