Skip to content

Commit 5fabcff

Browse files
committed
Relax rules on what can be accepted as classic histogram for b compat
Allow missing _sum and _count and set rules for interpretation if needed. Signed-off-by: György Krajcsovits <[email protected]>
1 parent 8f6e05e commit 5fabcff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,8 @@ Quantiles MAY be in any order.
892892

893893
The MetricPoint's Sum Value Sample MetricName MUST have the suffix `_sum`. The MetricPoint's Count Value Sample MetricName MUST have the suffix `_count`. The MetricPoint's Classic Bucket values Sample MetricNames MUST have the suffix `_bucket`.
894894

895+
For backwards compatibility with version OpenMetrics 1.0, ingestors MAY allow Histogram MetricPoints without Sum or Count value. In case of missing Sum it MAY be interpreted as 0 if needed. In case of missing Count it MAY be copied from the +Inf bucket if needed.
896+
895897
If present the MetricPoint's Created Timestamp MUST be inlined with the Metric point with a `ct@` prefix. If the value's timestamp is present, the Created Timestamp MUST be added right after it. If exemplar is present, the Created Timestamp MUST be added before it. Created Timestamp MUST be appended to all Classic Bucket values, to the MetricPoint's Sum and MetricPoint's Count.
896898

897899
Classic Buckets MUST be sorted in number increasing order of "le", and the value of the "le" label MUST follow the rules for Canonical Numbers.
@@ -922,13 +924,15 @@ The MetricPoint's value MUST be a complex data type.
922924
Histograms with Native Buckets MUST use the integer native histogram data type.
923925

924926
The integer native histogram data type is represented as structured data with fields. There MUST NOT be any whitespace around fields.
925-
The integer native histogram data type MUST include the Count, Sum, Schema, Zero Threshold, Zero Native Bucket value as the fields `count`, `sum`, `schema`, `zero_threshold`, `zero_count`.
927+
The integer native histogram data type MUST include the Count, Sum, Schema, Zero Threshold, Zero Native Bucket value as the fields `count`, `sum`, `schema`, `zero_threshold`, `zero_count`, in this order.
926928

927929
If there are no negative Native Buckets, then the fields `negative_spans` and `negative_buckets` SHOULD be omitted.
928930
If there are no positive Native Buckets, then the fields `positive_spans` and `positive_buckets` SHOULD be omitted.
929931

930932
If there are negative (and/or positive) Native Buckets, then the fields `negative_spans`, `negative_buckets` (and/or `positive_spans`, `positive_buckets`) MUST be present in this order after the `zero_count` field.
931933

934+
With the exception of the `sum` and `zero_threshold` field, all numbers MUST be integers and MUST NOT include dot '.' or exponent 'e'.
935+
932936
Native Bucket values MUST be ordered by their index, and their values MUST be placed in the `negative_buckets` (and/or `positive_buckets`) fields.
933937

934938
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.
@@ -996,6 +1000,8 @@ foo_sum 324789.3 [email protected]
9961000

9971001
The MetricPoint's Sum Value Sample MetricName MUST have the suffix `_gsum`. The MetricPoint's Count Value Sample MetricName MUST have the suffix `_gcount`. The MetricPoint's Classic Bucket values Sample MetricNames MUST have the suffix `_bucket`.
9981002

1003+
For backwards compatibility with version OpenMetrics 1.0, ingestors MAY allow Histogram MetricPoints without Sum or Count value. In case of missing Sum it MAY be interpreted as 0 if needed. In case of missing Count it MAY be copied from the +Inf bucket if needed.
1004+
9991005
Classic Buckets MUST be sorted in number increasing order of "le", and the value of the "le" label MUST follow the rules for Canonical Numbers.
10001006

10011007
An example of a Metric with no labels, and one MetricPoint value with no Exemplar with no Exemplars in the buckets:

0 commit comments

Comments
 (0)