Skip to content

Commit c16426b

Browse files
committed
Update with exemplars
Allow multiple exemplars for complex types, i.e. native histograms. But require that the timestamp is present. Signed-off-by: György Krajcsovits <[email protected]>
1 parent 4da9670 commit c16426b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Each MetricPoint consists of a set of values, depending on the MetricFamily type
106106

107107
Exemplars are references to data outside of the MetricSet. A common use case are IDs of program traces.
108108

109-
Exemplars MUST consist of a LabelSet and a value, and MAY have a timestamp. They MAY each be different from the MetricPoints' LabelSet and timestamp.
109+
Exemplars MUST consist of a LabelSet and a value. Exemplars associated with numeric values MAT have a timestamp. Exemplars associated with complex types MUST have a timestamp. They MAY each be different from the MetricPoints' LabelSet and timestamp.
110110

111111
The combined length of the label names and values of an Exemplar's LabelSet MUST NOT exceed 128 UTF-8 character code points. Other characters in the text rendering of an exemplar such as `",=` are not included in this limit for implementation simplicity and for consistency between the text and proto formats.
112112

@@ -392,16 +392,17 @@ metric = *sample
392392
metric-type = counter / gauge / histogram / gaugehistogram / stateset
393393
metric-type =/ info / summary / unknown
394394
395-
sample = metricname [labels] SP value [SP timestamp] [exemplar] LF
395+
sample = metricname [labels] SP number [SP timestamp] [exemplar] LF
396+
sample =/ metricname [labels] SP "{" complextype "}" [SP timestamp] *exemplar-ts LF
396397
397-
exemplar = SP HASH SP labels SP number [SP timestamp]
398+
exemplar = exemplar-base [SP timestamp]
399+
exemplar-ts = exemplar-base SP timestamp
400+
exemplar-base = SP HASH SP labels SP number
398401
399402
labels = "{" [label *(COMMA label)] "}"
400403
401404
label = label-name EQ DQUOTE escaped-string DQUOTE
402405
403-
value = number / "{" complextype "}"
404-
405406
number = realnumber
406407
; Case insensitive
407408
number =/ [SIGN] ("inf" / "infinity")
@@ -859,7 +860,7 @@ foo{quantile="0.99"} 150.0
859860

860861
Quantiles MAY be in any order.
861862

862-
##### Histogram with class buckets
863+
##### Histogram with classic buckets
863864

864865
The MetricPoint's Bucket Values Sample MetricNames MUST have the suffix `_bucket`. If present, the MetricPoint's Sum Value Sample MetricName MUST have the suffix `_sum`. If present, the MetricPoint's Created Value Sample MetricName MUST have the suffix `_created`.
865866
If and only if a Sum Value is present in a MetricPoint, then the MetricPoint's +Inf Bucket value MUST also appear in a Sample with a MetricName with the suffix "_count".
@@ -908,15 +909,15 @@ The sum of all length values in each span list MUST be equal to the length of th
908909

909910
An example with all fields:
910911

911-
```
912+
```openmetrics-add-eof
912913
# TYPE acme_http_request_seconds histogram
913914
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_deltas:[5,2],positive_spans:[-1:2,3:4],positive_deltas:[5,2,3,-1,-1,0]}
914915
acme_http_request_seconds_created 1520430000.123
915916
```
916917

917918
An example without any buckets in use:
918919

919-
```
920+
```openmetrics-add-eof
920921
# TYPE acme_http_request_seconds histogram
921922
acme_http_request_seconds{path="/api/v1",method="GET"} {count:0,sum:0,schema:3,zero_threshold:1e-4,zero_count:0}
922923
acme_http_request_seconds_created 1520430000.123
@@ -928,7 +929,7 @@ If a Histogram MetricPoint has both classic and exponential buckets, the exponen
928929

929930
The order ensures that implementations can easily skip the classic buckets if the exponential buckets are preferred.
930931

931-
```
932+
```openmetrics-add-eof
932933
# TYPE acme_http_request_seconds histogram
933934
# UNIT acme_http_request_seconds seconds
934935
# HELP acme_http_request_seconds Latency histogram of all of ACME's HTTP requests.
@@ -946,10 +947,12 @@ acme_http_request_seconds_created{path="/api/v1",method="GET"} 1605281325.0
946947
Exemplars without Labels MUST represent an empty LabelSet as {}.
947948

948949
An example of Exemplars showcasing several valid cases:
950+
The native histogram version of the histogram has multiple Exemplars.
949951
The "0.01" bucket has no Exemplar. The 0.1 bucket has an Exemplar with no Labels. The 1 bucket has an Exemplar with one Label. The 10 bucket has an Exemplar with a Label and a timestamp. In practice all buckets SHOULD have the same style of Exemplars.
950952

951953
```openmetrics-add-eof
952954
# TYPE foo histogram
955+
foo {count:10,sum:1.0,schema:0,zero_threshold:1e-4,zero_count:0,positive_spans:[0:2],positive_deltas:[5,0]} # {trace_id="shaZ8oxi"} 0.67 1520879607.789 # {trace_id="ookahn0M"} 1.2 1520879608.589
953956
foo_bucket{le="0.01"} 0
954957
foo_bucket{le="0.1"} 8 # {} 0.054
955958
foo_bucket{le="1"} 11 # {trace_id="KOO5S4vxi0o"} 0.67

0 commit comments

Comments
 (0)