Skip to content

Commit 4dfa8d1

Browse files
committed
fix(om2.0): fixes in type text format
The one major fix is that a gauge histogram doesn't have start time. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 parent cb6e9bf commit 4dfa8d1

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ Label values MAY be any valid UTF-8 value, so escaping MUST be applied as per th
711711
bar_seconds_count{a="x",b="escaping\" example \n "} 0
712712
```
713713

714-
Metric names and label names MAY also be any valid UTF-8 value, and under certain circumstances they MUST be quoted and escaped per the ABNF. See the UTF-8 Quoting section for specifics.
714+
Metric names and label names MAY also be any valid UTF-8 value, and under certain circumstances they MUST be quoted and escaped per the ABNF. See the [UTF-8 Quoting](#utf-8-quoting) section for specifics.
715715

716716
```openmetrics-add-eof
717717
{"\"bar\".seconds.count","b\\"="escaping\" example \n "} 0
@@ -721,6 +721,8 @@ Metric names and label names MAY also be any valid UTF-8 value, and under certai
721721

722722
#### Gauge
723723

724+
The Sample's value MUST be a Number.
725+
724726
There are no recommended suffixes for the MetricFamily name for a MetricFamily of Type Gauge.
725727

726728
An example MetricFamily with a Metric with no labels and a Sample with no timestamp:
@@ -768,6 +770,8 @@ foo 18.0 456
768770

769771
#### Counter
770772

773+
The Sample's value MUST be a Number.
774+
771775
If present, the Sample's Start Timestamp MUST be inlined with the Sample with a `st@` prefix. If the value's timestamp is present, the Start Timestamp MUST be added right after it. If exemplar is present, the Start Timestamp MUST be added before it.
772776

773777
An example with a Metric with no labels, and a Sample with no timestamp and no Start Timestamp:
@@ -798,7 +802,7 @@ An example with a Metric with no labels, and a Sample with a timestamp and a Sta
798802
foo_total 17.0 1520879607.789 st@1520430000.123
799803
```
800804

801-
An example with a Metric with no labels, and a Sample without the `_total` suffix and with a timestamp and a start timestamp:
805+
An example with a Metric with no labels, and without the `_total` suffix and a Sample with a timestamp and a start timestamp:
802806

803807
```openmetrics-add-eof
804808
# TYPE foo counter
@@ -923,14 +927,14 @@ If present the Sample's Start Timestamp MUST be inlined with the Sample with a `
923927

924928
The quantiles MUST be sorted in increasing order of the quantile.
925929

926-
An example of a Metric with no labels and a Sample with Sum, Count and Start Timestamp values:
930+
An example of a Metric with no labels and a Sample with Sum, Count and Start Timestamp:
927931

928932
```openmetrics-add-eof
929933
# TYPE foo summary
930934
foo {count:17,sum:324789.3,quantile:[]} st@1520430000.123
931935
```
932936

933-
An example of a Metric with no labels and a Sample with two quantiles and Start Timestamp values:
937+
An example of a Metric with no labels and a Sample with two quantiles and Start Timestamp:
934938

935939
```openmetrics-add-eof
936940
# TYPE foo summary
@@ -968,6 +972,8 @@ If there are negative (and/or positive) Native Buckets, then the fields `negativ
968972

969973
Native Bucket values MUST be ordered by their index, and their values MUST be placed in the `negative_buckets` (and/or `positive_buckets`) fields.
970974

975+
> NOTE: Bucket values are absolute counts, as opposed to some implementations that store bucket values as deltas relative to the preceding bucket.
976+
971977
Native Buckets that have a value of 0 SHOULD NOT be present.
972978

973979
To map the `negative_buckets` (and/or `positive_buckets`) back to their indices, the `negative_spans` (and/or `positive_spans`) field MUST be constructed in the following way: Each span consists of a pair of numbers, an integer called offset and an non-negative integer called length. Only the first span in each list can have a negative offset. It defines the index of the first bucket in its corresponding `negative_buckets` (and/or `positive_buckets`). The length defines the number of consecutive buckets the bucket list starts with. The offsets of the following spans define the number of excluded (and thus unpopulated buckets). The lengths define the number of consecutive buckets in the list following the excluded buckets.
@@ -1042,13 +1048,9 @@ foo {count:17,sum:324789.3,schema:0,zero_threshold:1e-4,zero_count:0,positive_sp
10421048

10431049
#### GaugeHistogram with Classic Buckets
10441050

1045-
The Sample's value MUST be a CompositeValue.
1046-
1047-
The CompositeValue MUST include the Gcount, Gsum and Classic Bucket values as the fields `count`, `sum`, `bucket`, in this order.
1048-
1049-
Classic Buckets MUST be sorted in number increasing order of their threshold.
1051+
GaugeHistogram Samples with Classic Buckets follow the same syntax as Histogram Samples with Classic Buckets.
10501052

1051-
An example of a Metric with no labels, and one Sample value with no Exemplar with no Exemplars in the buckets:
1053+
An example of a Metric with no labels, and one Sample value with no timestamp, no Start Timestamp, and no Exemplars:
10521054

10531055
```openmetrics-add-eof
10541056
# TYPE foo gaugehistogram
@@ -1059,9 +1061,11 @@ foo {count:42,sum:3289.3,bucket:[0.01:20,0.1:25,1:34,+Inf:42]}
10591061

10601062
GaugeHistogram Samples with Native Buckets follow the same syntax as Histogram Samples with Native Buckets.
10611063

1064+
An example of a Metric with no labels, and one Sample value with no timestamp, no Start Timestamp, and no Exemplars:
1065+
10621066
```openmetrics-add-eof
10631067
# TYPE acme_http_request_seconds gaugehistogram
1064-
acme_http_request_seconds{path="/api/v1",method="GET"} {count:59,sum:1.2e2,schema:7,zero_threshold:1e-4,zero_count:0,negative_spans:[1:2],negative_buckets:[5,7],positive_spans:[-1:2,3:4],positive_buckets:[5,7,10,9,8,8]} st@1520430000.123
1068+
acme_http_request_seconds{path="/api/v1",method="GET"} {count:59,sum:1.2e2,schema:7,zero_threshold:1e-4,zero_count:0,negative_spans:[1:2],negative_buckets:[5,7],positive_spans:[-1:2,3:4],positive_buckets:[5,7,10,9,8,8]}
10651069
```
10661070

10671071
#### GaugeHistogram with both Classic and Native buckets
@@ -1070,6 +1074,8 @@ GaugeHistogram Samples with both Classic and Native Buckets follow the same synt
10701074

10711075
#### Unknown
10721076

1077+
The Sample's value MUST be a Number.
1078+
10731079
There are no recommended suffixes for the MetricFamily name for a MetricFamily of Type Unknown.
10741080

10751081
An example with a Metric with no labels and a Sample with no timestamp:
@@ -1079,6 +1085,12 @@ An example with a Metric with no labels and a Sample with no timestamp:
10791085
foo 42.23
10801086
```
10811087

1088+
An example with a Metric without MetricFamily metadata and a Sample with no timestamp:
1089+
1090+
```openmetrics-add-eof
1091+
foo 42.23
1092+
```
1093+
10821094
## Design Considerations
10831095

10841096
### Scope

0 commit comments

Comments
 (0)