Skip to content

Commit aca6583

Browse files
committed
Classic histogram and summary as complex types
Ref: prometheus/OpenMetrics#283 Signed-off-by: György Krajcsovits <[email protected]>
1 parent 19b2d91 commit aca6583

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ This section MUST be read together with the ABNF section. In case of disagreemen
6262

6363
#### Values
6464

65-
Metric values in OpenMetrics MUST be either floating points or integers. Note that ingestors of the format MAY only support float64. The non-real values NaN, +Inf and -Inf MUST be supported. NaN MUST NOT be considered a missing value, but it MAY be used to signal a division by zero.
65+
Metric values in OpenMetrics MUST be either numbers or complex data types.
66+
67+
Numbers MUST be either floating points or integers. Note that ingestors of the format MAY only support float64. The non-real values NaN, +Inf and -Inf MUST be supported. NaN MUST NOT be considered a missing value, but it MAY be used to signal a division by zero.
68+
69+
Complex data types MUST contain all information necessary to recreate a sample of a Metric Type, with the exception of Created Value and Exemplars.
70+
71+
List of complex data types:
72+
- Integer counter classic histogram for the Metric Type Histogram.
73+
- Classic summary for the Metric Type Summary.
6674

6775
##### Booleans
6876

@@ -322,8 +330,11 @@ metric-type = counter / gauge / histogram / gaugehistogram / stateset
322330
metric-type =/ info / summary / unknown
323331
324332
sample = metricname [labels] SP number [SP timestamp] [exemplar] LF
333+
sample =/ metricname [labels] SP "{" complextype "}" [SP timestamp] *exemplar-ts LF
325334
326-
exemplar = SP HASH SP labels SP number [SP timestamp]
335+
exemplar = exemplar-base [SP timestamp]
336+
exemplar-ts = exemplar-base SP timestamp
337+
exemplar-base = SP HASH SP labels SP number
327338
328339
labels = "{" [label *(COMMA label)] "}"
329340
@@ -383,6 +394,35 @@ escaped-char =/ BS normal-char
383394
384395
; Any unicode character, except newline, double quote, and backslash
385396
normal-char = %x00-09 / %x0B-21 / %x23-5B / %x5D-D7FF / %xE000-10FFFF
397+
398+
; Complex types
399+
complextype = classic-histogram / classic-summary
400+
401+
; count:12.0,sum:100.0,bucket:[0.1:3.0,05:12.0,+Inf:12.0]
402+
classic-histogram = ch-count "," ch-sum "," ch-bucket
403+
404+
; count:x where x is a real number, not +-Inf or NaN
405+
ch-count = %d99.111.117.110.116 ":" realnumber
406+
; sum:x where x is a real number or +-Inf or NaN
407+
ch-sum = %d115.117.109 ":" number
408+
; bucket:[...]
409+
ch-bucket = %d98.117.99.107.101.116 ":" "[" ch-le-counts "]"
410+
ch-le-counts = ch-pos-inf-bucket / (ch-neg-inf-bucket / ch-bucket) *("," ch-bucket) "," ch-pos-inf-bucket
411+
ch-pos-inf-bucket = "+" %d73.110.102 ":" realnumber
412+
ch-neg-inf-bucket = "-" %d73.110.102 ":" realnumber
413+
ch-bucket = realnumber ":" realnumber
414+
415+
; count:12.0,sum:100.0,quantile:[0.9:2.0,0.95:3.0,0.99:20.0]
416+
classic-summary = cs-count "," cs-sum "," cs-quantile
417+
418+
; count:x where x is a real number, not +-Inf or NaN
419+
cs-count = %d99.111.117.110.116 ":" realnumber
420+
; sum:x where x is a real number or +-Inf or NaN
421+
cs-sum = %d115.117.109 ":" number
422+
; quantile:[...]
423+
cs-quantile = %d113.117.97.110.116.105.108.101 ":" "[" cs-q-counts "]"
424+
cs-q-counts = *cs-q-count
425+
cs-q-count = realnumber ":" realnumber
386426
```
387427

388428
#### Overall Structure
@@ -400,15 +440,16 @@ Line endings MUST be signalled with line feed (\n) and MUST NOT contain carriage
400440
An example of a complete exposition:
401441

402442
```openmetrics
443+
# TYPE acme_http_server_request_seconds histogram
444+
# UNIT acme_http_server_request_seconds seconds
445+
# HELP acme_http_server_request_seconds Latency though all of ACME's HTTP request service.
446+
acme_http_router_request_seconds{path="/api/v1",method="GET"} {count:10.0,sum:100.0,bucket:[0.1:2.0,0.5:50.0,+Inf:10.0]}
447+
acme_http_router_request_seconds{path="/api/v2",method="GET"} {count:1.0,sum:10.0,bucket:[0.1:1.0,0.5:1.0,+Inf:1.0]}
403448
# TYPE acme_http_router_request_seconds summary
404449
# UNIT acme_http_router_request_seconds seconds
405450
# HELP acme_http_router_request_seconds Latency though all of ACME's HTTP request router.
406-
acme_http_router_request_seconds_sum{path="/api/v1",method="GET"} 9036.32
407-
acme_http_router_request_seconds_count{path="/api/v1",method="GET"} 807283.0
408-
acme_http_router_request_seconds_created{path="/api/v1",method="GET"} 1605281325.0
409-
acme_http_router_request_seconds_sum{path="/api/v2",method="POST"} 479.3
410-
acme_http_router_request_seconds_count{path="/api/v2",method="POST"} 34.0
411-
acme_http_router_request_seconds_created{path="/api/v2",method="POST"} 1605281325.0
451+
acme_http_router_request_seconds{path="/api/v1",method="GET"} {count:10.0,sum:100.0,quantile:[0.95:2.0,0.99:20.0]}
452+
acme_http_router_request_seconds{path="/api/v2",method="GET"} {count:1.0,sum:10.0,quantile:[0.95:2.0,0.99:2.0]}
412453
# TYPE go_goroutines gauge
413454
# HELP go_goroutines Number of goroutines that currently exist.
414455
go_goroutines 69

0 commit comments

Comments
 (0)