Skip to content

Commit 1a92fbd

Browse files
committed
fix(om2): make gauge histogram distinguishable from one line
Change count and sum to `gcount` and `gsum` in the exposition for gauge histograms. This mirrors OM 1.0 suffixes. There's too many complications if we don't do this. The only downside is that the histogram functions in PromQL don't have a gauge version, but I think we can live with that. Or even add those later if anyone needs them - which I doubt. Also fix that gauge histograms model currently doesn't have start timestamp, but our text format seemed to conflict with this. Signed-off-by: György Krajcsovits <[email protected]>
1 parent 4dfa8d1 commit 1a92fbd

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Quantiles are a map from a quantile to a value. An example is a quantile 0.95 wi
371371

372372
Unknown SHOULD NOT be used. Unknown MAY be used when it is impossible to determine the types of individual metrics from 3rd party systems.
373373

374-
A Sample in a metric with the Unknown Type MUST have a Number value.
374+
A Sample in a metric with the Unknown Type MUST have a Number or CompositeValue value.
375375

376376
## Text Format
377377

@@ -489,15 +489,20 @@ normal-char = %x00-09 / %x0B-21 / %x23-5B / %x5D-D7FF / %xE000-10FFFF
489489
start-timestamp = %d115.116 "@" timestamp
490490
491491
; Composite values
492-
composite-value = histogram-value / summary-value
492+
composite-value = histogram-value / gauge-histogram-value / summary-value
493493
494494
; Histograms
495495
histogram-value = h-count "," h-sum "," histogram-buckets
496+
gauge-histogram-value = gh-count "," gh-sum "," histogram-buckets
496497
497498
; count:x
498499
h-count = %d99.111.117.110.116 ":" number
500+
; gcount:x
501+
gh-count = %d103 h-count
499502
; sum:f allows real numbers and +-Inf and NaN
500503
h-sum = %d115.117.109 ":" number
504+
; gsum:x
505+
gh-sum = %d103 h-sum
501506
502507
histogram-buckets = classic-buckets / native-buckets [ "," classic-buckets ]
503508
native-buckets = nh-schema "," nh-zero-threshold "," nh-zero-count [ "," nh-negative-spans "," nh-negative-buckets ] [ "," nh-positive-spans "," nh-positive-buckets ]
@@ -583,7 +588,7 @@ process_cpu_seconds_total 4.20072246e+06
583588
# HELP acme_http_request_seconds Latency histogram of all of ACME's HTTP requests.
584589
acme_http_request_seconds{path="/api/v1",method="GET"} {count:2,sum:1.2e2,schema:0,zero_threshold:1e-4,zero_count:0,positive_spans:[1:2],positive_buckets:[1,1],bucket:[0.5:1,1:2,+Inf:2]} [email protected]
585590
# TYPE acme_http_request_seconds:rate5m gaugehistogram
586-
acme_http_request_seconds:rate5m{path="/api/v1",method="GET"} {count:0.01,sum:2.0,schema:0,zero_threshold:1e-4,zero_count:0.0,positive_spans:[1:2],positive_buckets:[0.005,0.005]} [email protected]
591+
acme_http_request_seconds:rate5m{path="/api/v1",method="GET"} {gcount:0.01,gsum:2.0,schema:0,zero_threshold:1e-4,zero_count:0.0,positive_spans:[1:2],positive_buckets:[0.005,0.005]}
587592
# TYPE "foodb.read.errors" counter
588593
# HELP "foodb.read.errors" The number of errors in the read path for fooDb.
589594
{"foodb.read.errors","service.name"="my_service"} 3482
@@ -1048,33 +1053,33 @@ foo {count:17,sum:324789.3,schema:0,zero_threshold:1e-4,zero_count:0,positive_sp
10481053

10491054
#### GaugeHistogram with Classic Buckets
10501055

1051-
GaugeHistogram Samples with Classic Buckets follow the same syntax as Histogram Samples with Classic Buckets.
1056+
GaugeHistogram Samples with Classic Buckets follow the same syntax as Histogram Samples with Classic Buckets, except that the Count and Sum are exposed as the fields `gcount` and `gsum` and GaugeHistograms do not have Start Timestamp.
10521057

10531058
An example of a Metric with no labels, and one Sample value with no timestamp, no Start Timestamp, and no Exemplars:
10541059

10551060
```openmetrics-add-eof
10561061
# TYPE foo gaugehistogram
1057-
foo {count:42,sum:3289.3,bucket:[0.01:20,0.1:25,1:34,+Inf:42]}
1062+
foo {gcount:42,gsum:3289.3,bucket:[0.01:20,0.1:25,1:34,+Inf:42]}
10581063
```
10591064

10601065
#### GaugeHistogram with Native Buckets
10611066

1062-
GaugeHistogram Samples with Native Buckets follow the same syntax as Histogram Samples with Native Buckets.
1067+
GaugeHistogram Samples with Native Buckets follow the same syntax as Histogram Samples with Native Buckets, except that the Count and Sum are exposed as the fields `gcount` and `gsum` and GaugeHistograms do not have Start Timestamp.
10631068

10641069
An example of a Metric with no labels, and one Sample value with no timestamp, no Start Timestamp, and no Exemplars:
10651070

10661071
```openmetrics-add-eof
10671072
# TYPE acme_http_request_seconds gaugehistogram
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]}
1073+
acme_http_request_seconds{path="/api/v1",method="GET"} {gcount:59,gsum: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]}
10691074
```
10701075

10711076
#### GaugeHistogram with both Classic and Native buckets
10721077

1073-
GaugeHistogram Samples with both Classic and Native Buckets follow the same syntax as Histogram Samples with both Classic and Native Buckets.
1078+
GaugeHistogram Samples with both Classic and Native Buckets follow the same syntax as Histogram Samples with both Classic and Native Buckets, except that the Count and Sum are exposed as the fields `gcount` and `gsum` and GaugeHistograms do not have Start Timestamp.
10741079

10751080
#### Unknown
10761081

1077-
The Sample's value MUST be a Number.
1082+
The Sample's value MUST be a Number or a CompositeValue.
10781083

10791084
There are no recommended suffixes for the MetricFamily name for a MetricFamily of Type Unknown.
10801085

0 commit comments

Comments
 (0)