Skip to content

Commit a04d7ce

Browse files
authored
chore(om2.0): rename created timestamp to start timestamp (#2770)
From dev summit decision on 23rd October 2023. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 parent 9b2c67b commit a04d7ce

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

docs/specs/om/open_metrics_spec_2_0.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ Counters measure discrete events. Common examples are the number of HTTP request
192192

193193
A MetricPoint in a Metric with the type Counter MUST have one value called Total. A Total is a non-NaN and MUST be monotonically non-decreasing over time, starting from 0.
194194

195-
A MetricPoint in a Metric with the type Counter SHOULD have a Timestamp value called Created Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before.
195+
A MetricPoint in a Metric with the type Counter SHOULD have a Timestamp value called Start Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before.
196196

197-
A MetricPoint in a Metric's Counter's Total MAY reset to 0. If present, the corresponding Created Timestamp MUST also be set to the timestamp of the reset.
197+
A MetricPoint in a Metric's Counter's Total MAY reset to 0. If present, the corresponding Start Timestamp MUST also be set to the timestamp of the reset.
198198

199199
A MetricPoint in a Metric's Counter's Total MAY have an exemplar.
200200

@@ -230,7 +230,7 @@ MetricFamilies of type Info MUST have an empty Unit string.
230230

231231
Histograms measure distributions of discrete events. Common examples are the latency of HTTP requests, function runtimes, or I/O request sizes.
232232

233-
A Histogram MetricPoint MUST contain at least one bucket, and SHOULD contain Sum, and Created Timestamp values. Every bucket MUST have a threshold and a value.
233+
A Histogram MetricPoint MUST contain at least one bucket, and SHOULD contain Sum, and Start Timestamp values. Every bucket MUST have a threshold and a value.
234234

235235
Histogram MetricPoints MUST have one bucket with an +Inf threshold. Buckets MUST be cumulative. As an example for a metric representing request latency in seconds its values for buckets with thresholds 1, 2, 3, and +Inf MUST follow value_1 <= value_2 <= value_3 <= value_+Inf. If ten requests took 1 second each, the values of the 1, 2, 3, and +Inf buckets MUST equal 10.
236236

@@ -242,7 +242,7 @@ The Sum is only a counter semantically as long as there are no negative event va
242242

243243
Negative threshold buckets MAY be used. Bucket thresholds MUST NOT equal NaN. Count and bucket values MUST be integers.
244244

245-
A Histogram MetricPoint SHOULD have a Timestamp value called Created Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before.
245+
A Histogram MetricPoint SHOULD have a Timestamp value called Start Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before.
246246

247247
A Histogram's Metric's LabelSet MUST NOT have a "le" label name.
248248

@@ -276,12 +276,12 @@ Summaries also measure distributions of discrete events and MAY be used when His
276276

277277
They MAY also be used for backwards compatibility, because some existing instrumentation libraries expose precomputed quantiles and do not support Histograms. Precomputed quantiles SHOULD NOT be used, because quantiles are not aggregatable and the user often can not deduce what timeframe they cover.
278278

279-
A Summary MetricPoint MAY consist of a Count, Sum, Created Timestamp, and a set of quantiles.
279+
A Summary MetricPoint MAY consist of a Count, Sum, Start Timestamp, and a set of quantiles.
280280

281281
Semantically, Count and Sum values are counters so MUST NOT be NaN or negative.
282282
Count MUST be an integer.
283283

284-
A MetricPoint in a Metric with the type Summary which contains Count or Sum values SHOULD have a Timestamp value called Created Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before. Created Timestamp MUST NOT relate to the collection period of quantile values.
284+
A MetricPoint in a Metric with the type Summary which contains Count or Sum values SHOULD have a Timestamp value called Start Timestamp. This can help ingestors discern between new metrics and long-running ones it did not see before. Start Timestamp MUST NOT relate to the collection period of quantile values.
285285

286286
Quantiles are a map from a quantile to a value. An example is a quantile 0.95 with value 0.2 in a metric called myapp_http_request_duration_seconds which means that the 95th percentile latency is 200ms over an unknown timeframe. If there are no events in the relevant timeframe, the value for a quantile MUST be NaN.
287287
A Quantile's Metric's LabelSet MUST NOT have "quantile" label name.
@@ -338,7 +338,7 @@ metric = *sample
338338
metric-type = counter / gauge / histogram / gaugehistogram / stateset
339339
metric-type =/ info / summary / unknown
340340
341-
sample = metricname-and-labels SP number [SP timestamp] [SP created] [exemplar] LF
341+
sample = metricname-and-labels SP number [SP timestamp] [SP start-timestamp] [exemplar] LF
342342
343343
exemplar = SP HASH SP labels-in-braces SP number [SP timestamp]
344344
@@ -406,8 +406,8 @@ escaped-char =/ BS normal-char
406406
; Any unicode character, except newline, double quote, and backslash
407407
normal-char = %x00-09 / %x0B-21 / %x23-5B / %x5D-D7FF / %xE000-10FFFF
408408
409-
; Lowercase ct @ timestamp
410-
created = %d99.116 "@" timestamp
409+
; Lowercase st @ timestamp
410+
start-timestamp = %d115.116 "@" timestamp
411411
```
412412

413413
#### Overall Structure
@@ -428,10 +428,10 @@ An example of a complete exposition:
428428
# TYPE acme_http_router_request_seconds summary
429429
# UNIT acme_http_router_request_seconds seconds
430430
# HELP acme_http_router_request_seconds Latency though all of ACME's HTTP request router.
431-
acme_http_router_request_seconds_sum{path="/api/v1",method="GET"} 9036.32 ct@1605281325.0
432-
acme_http_router_request_seconds_count{path="/api/v1",method="GET"} 807283.0 ct@1605281325.0
433-
acme_http_router_request_seconds_sum{path="/api/v2",method="POST"} 479.3 ct@1605301325.0
434-
acme_http_router_request_seconds_count{path="/api/v2",method="POST"} 34.0 ct@1605301325.0
431+
acme_http_router_request_seconds_sum{path="/api/v1",method="GET"} 9036.32 st@1605281325.0
432+
acme_http_router_request_seconds_count{path="/api/v1",method="GET"} 807283.0 st@1605281325.0
433+
acme_http_router_request_seconds_sum{path="/api/v2",method="POST"} 479.3 st@1605301325.0
434+
acme_http_router_request_seconds_count{path="/api/v2",method="POST"} 34.0 st@1605301325.0
435435
# TYPE go_goroutines gauge
436436
# HELP go_goroutines Number of goroutines that currently exist.
437437
go_goroutines 69
@@ -660,52 +660,52 @@ foo 18.0 456
660660

661661
##### Counter
662662

663-
The MetricPoint's Total Value Sample MetricName SHOULD have the suffix `_total`. 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.
663+
The MetricPoint's Total Value Sample MetricName SHOULD have the suffix `_total`. If present, the MetricPoint's Start Timestamp MUST be inlined with the Metric point 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.
664664

665665
Be aware that exposing metrics without `_total` being a suffix of the MetricFamily name directly to end-users may reduce the usability due to confusion about what the metric's type is.
666666

667-
An example with a Metric with no labels, and a MetricPoint with no timestamp and no Created Timestamp:
667+
An example with a Metric with no labels, and a MetricPoint with no timestamp and no Start Timestamp:
668668

669669
```openmetrics-add-eof
670670
# TYPE foo counter
671671
foo_total 17.0
672672
```
673673

674-
An example with a Metric with no labels, and a MetricPoint with a timestamp and no Created Timestamp:
674+
An example with a Metric with no labels, and a MetricPoint with a timestamp and no Start Timestamp:
675675

676676
```openmetrics-add-eof
677677
# TYPE foo counter
678678
foo_total 17.0 1520879607.789
679679
```
680680

681-
An example with a Metric with no labels, and a MetricPoint with no timestamp and a Created Timestamp:
681+
An example with a Metric with no labels, and a MetricPoint with no timestamp and a Start Timestamp:
682682

683683
```openmetrics-add-eof
684684
# TYPE foo counter
685-
foo_total 17.0 ct@1520430000.123
685+
foo_total 17.0 st@1520430000.123
686686
```
687687

688-
An example with a Metric with no labels, and a MetricPoint with a timestamp and a Created Timestamp:
688+
An example with a Metric with no labels, and a MetricPoint with a timestamp and a Start Timestamp:
689689

690690
```openmetrics-add-eof
691691
# TYPE foo counter
692-
foo_total 17.0 1520879607.789 ct@1520430000.123
692+
foo_total 17.0 1520879607.789 st@1520430000.123
693693
```
694694

695-
An example with a Metric with no labels, and a MetricPoint without the `_total` suffix and with a timestamp and a created:
695+
An example with a Metric with no labels, and a MetricPoint without the `_total` suffix and with a timestamp and a start timestamp:
696696

697697
```openmetrics-add-eof
698698
# TYPE foo counter
699-
foo 17.0 1520879607.789 ct@1520879607.789
699+
foo 17.0 1520879607.789 st@1520879607.789
700700
```
701701

702702
Exemplars MAY be attached to the MetricPoint's Total sample.
703703

704-
An example with a Metric with no labels, and a MetricPoint with a timestamp and a Created Timestamp and an exemplar:
704+
An example with a Metric with no labels, and a MetricPoint with a timestamp and a Start Timestamp and an exemplar:
705705

706706
```openmetrics-add-eof
707707
# TYPE foo counter
708-
foo_total 17.0 1520879607.789 ct@1520430000.123 # {trace_id="KOO5S4vxi0o"} 0.67
708+
foo_total 17.0 1520879607.789 st@1520430000.123 # {trace_id="KOO5S4vxi0o"} 0.67
709709
```
710710

711711
##### StateSet
@@ -760,22 +760,22 @@ Metric labels and MetricPoint value labels MAY be in any order.
760760

761761
If present, the MetricPoint's Sum Value Sample MetricName MUST have the suffix `_sum`. If present, the MetricPoint's Count Value MetricName MUST have the suffix `_count`. If present, the MetricPoint's Quantile Values MUST specify the quantile measured using a label with a label name of "quantile" and with a label value of the quantile measured.
762762

763-
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 Quantile Values, to the MetricPoint's Sum and MetricPoint's Count.
763+
If present the MetricPoint's Start Timestamp MUST be inlined with the Metric point 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. Start Timestamp MUST be appended to all Quantile Values, to the MetricPoint's Sum and MetricPoint's Count.
764764

765-
An example of a Metric with no labels and a MetricPoint with Sum, Count and Created Timestamp values:
765+
An example of a Metric with no labels and a MetricPoint with Sum, Count and Start Timestamp values:
766766

767767
```openmetrics-add-eof
768768
# TYPE foo summary
769-
foo_count 17.0 ct@1520430000.123
770-
foo_sum 324789.3 ct@1520430000.123
769+
foo_count 17.0 st@1520430000.123
770+
foo_sum 324789.3 st@1520430000.123
771771
```
772772

773-
An example of a Metric with no labels and a MetricPoint with two quantiles and Created Timestamp values:
773+
An example of a Metric with no labels and a MetricPoint with two quantiles and Start Timestamp values:
774774

775775
```openmetrics-add-eof
776776
# TYPE foo summary
777-
foo{quantile="0.95"} 123.7 ct@1520430000.123
778-
foo{quantile="0.99"} 150.0 ct@1520430000.123
777+
foo{quantile="0.95"} 123.7 st@1520430000.123
778+
foo{quantile="0.99"} 150.0 st@1520430000.123
779779
```
780780

781781
Quantiles MAY be in any order.
@@ -784,29 +784,29 @@ Quantiles MAY be in any order.
784784

785785
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`.
786786

787-
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 Bucket Values, to the MetricPoint's Sum and MetricPoint's Count.
787+
If present the MetricPoint's Start Timestamp MUST be inlined with the Metric point 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. Start Timestamp MUST be appended to all Bucket Values, to the MetricPoint's Sum and MetricPoint's Count.
788788

789789
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".
790790

791791
Buckets MUST be sorted in number increasing order of "le", and the value of the "le" label MUST follow the rules for Canonical Numbers.
792792

793-
An example of a Metric with no labels and a MetricPoint with Sum, Count, and Created Timestamp values, and with 12 buckets. A wide and atypical but valid variety of “le” values is shown on purpose:
793+
An example of a Metric with no labels and a MetricPoint with Sum, Count, and Start Timestamp values, and with 12 buckets. A wide and atypical but valid variety of “le” values is shown on purpose:
794794

795795
```openmetrics-add-eof
796796
# TYPE foo histogram
797-
foo_bucket{le="0.0"} 0 ct@1520430000.123
798-
foo_bucket{le="1e-05"} 0 ct@1521430000.123
799-
foo_bucket{le="0.0001"} 5 ct@1521430020.123
800-
foo_bucket{le="0.1"} 8 ct@1520430321.123
801-
foo_bucket{le="1.0"} 10 ct@1522430000.123
802-
foo_bucket{le="10.0"} 11 ct@1520430123.123
803-
foo_bucket{le="100000.0"} 11 ct@1521430010.123
804-
foo_bucket{le="1e+06"} 15 ct@1520430301.123
805-
foo_bucket{le="1e+23"} 16 ct@1521430001.123
806-
foo_bucket{le="1.1e+23"} 17 ct@1522430220.123
807-
foo_bucket{le="+Inf"} 17 ct@1520430000.123
808-
foo_count 17 ct@1520430000.123
809-
foo_sum 324789.3 ct@1520430000.123
797+
foo_bucket{le="0.0"} 0 st@1520430000.123
798+
foo_bucket{le="1e-05"} 0 st@1521430000.123
799+
foo_bucket{le="0.0001"} 5 st@1521430020.123
800+
foo_bucket{le="0.1"} 8 st@1520430321.123
801+
foo_bucket{le="1.0"} 10 st@1522430000.123
802+
foo_bucket{le="10.0"} 11 st@1520430123.123
803+
foo_bucket{le="100000.0"} 11 st@1521430010.123
804+
foo_bucket{le="1e+06"} 15 st@1520430301.123
805+
foo_bucket{le="1e+23"} 16 st@1521430001.123
806+
foo_bucket{le="1.1e+23"} 17 st@1522430220.123
807+
foo_bucket{le="+Inf"} 17 st@1520430000.123
808+
foo_count 17 st@1520430000.123
809+
foo_sum 324789.3 st@1520430000.123
810810
```
811811

812812
###### Exemplars
@@ -818,13 +818,13 @@ The "0.01" bucket has no Exemplar. The 0.1 bucket has an Exemplar with no Labels
818818

819819
```openmetrics-add-eof
820820
# TYPE foo histogram
821-
foo_bucket{le="0.01"} 0 ct@1520430000.123
822-
foo_bucket{le="0.1"} 8 ct@1520430000.123 # {} 0.054
823-
foo_bucket{le="1"} 11 ct@1520430000.123 # {trace_id="KOO5S4vxi0o"} 0.67
824-
foo_bucket{le="10"} 17 ct@1520430000.123 # {trace_id="oHg5SJYRHA0"} 9.8 1520879607.789
825-
foo_bucket{le="+Inf"} 17 ct@1520430000.123
826-
foo_count 17 ct@1520430000.123
827-
foo_sum 324789.3 ct@1520430000.123
821+
foo_bucket{le="0.01"} 0 st@1520430000.123
822+
foo_bucket{le="0.1"} 8 st@1520430000.123 # {} 0.054
823+
foo_bucket{le="1"} 11 st@1520430000.123 # {trace_id="KOO5S4vxi0o"} 0.67
824+
foo_bucket{le="10"} 17 st@1520430000.123 # {trace_id="oHg5SJYRHA0"} 9.8 1520879607.789
825+
foo_bucket{le="+Inf"} 17 st@1520430000.123
826+
foo_count 17 st@1520430000.123
827+
foo_sum 324789.3 st@1520430000.123
828828
```
829829

830830
##### GaugeHistogram
@@ -1165,7 +1165,7 @@ my_time_since_boot_seconds 123
11651165
```
11661166

11671167
Conversely, there are no best practice restrictions on exemplars timestamps.
1168-
Keep in mind that due to race conditions or time not being perfectly synced across devices, that an exemplar timestamp may appear to be slightly in the future relative to a ingestor's system clock or other metrics from the same exposition. Similarly it is possible that a "ct@" for a MetricPoint could appear to be slightly after an exemplar or sample timestamp for that same MetricPoint.
1168+
Keep in mind that due to race conditions or time not being perfectly synced across devices, that an exemplar timestamp may appear to be slightly in the future relative to a ingestor's system clock or other metrics from the same exposition. Similarly it is possible that a "st@" for a MetricPoint could appear to be slightly after an exemplar or sample timestamp for that same MetricPoint.
11691169

11701170
Keep in mind that there are monitoring systems in common use which support everything from nanosecond to second resolution, so having two MetricPoints that have the same timestamp when truncated to second resolution may cause an apparent duplicate in the ingestor. In this case the MetricPoint with the earliest timestamp MUST be used.
11711171

0 commit comments

Comments
 (0)