Skip to content

Commit 768d1f8

Browse files
committed
feat: add an "Alternatives" section
Signed-off-by: Manik Rana <[email protected]>
1 parent 9531e66 commit 768d1f8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

proposals/2024-12-14_update-created-timestamps-for-openmetrics-text.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,31 @@ As stated above, `_created` lines can appear anywhere after its associated metr
5252

5353
## Alternatives
5454

55+
### Do nothing
56+
57+
Continue using the OM text format in its current state and further optimize CPU usage through PRs that build on [github.com/prometheus/prometheus/issues/14823](https://github.com/prometheus/prometheus/issues/14823) . This is desirable if we wish to keep backwards compatibility but we would have to live with an inefficient solution.
58+
59+
### Storing CTs Using a `# HELP`-Like Syntax
60+
61+
In addition to the `TYPE`, `UNIT`, and `HELP` fields, we can introduce a `# CREATED` line for metrics that have an associated creation timestamp (CT). This approach allows us to quickly determine whether a CT exists for a given metric, eliminating the need for a more time-consuming search process. By parsing the `# CREATED` line, we can associate it with a specific hash corresponding to the metric's label set, thereby mapping each CT to the correct metric.
62+
63+
However, this method still involves the overhead of storing the CT until we encounter the relevant metric line. A more efficient solution would be to place the CT inline with the metric itself, streamlining the process and reducing the need for intermediate storage.
64+
65+
Furthermore the `CREATED` line itself might look somewhat convoluted compared to `TYPE` , `UNIT` , and `HELP` which are very human readable. This new `CREATED` line can end up looking something like this:
66+
67+
```
68+
# HELP foo Counter with and without labels to certify CT is parsed for both cases
69+
# TYPE foo counter
70+
# CREATED 1520872607.123; {a="b"} 1520872607.123
71+
foo_total 17.0 1520879607.789 # {id="counter-test"} 5
72+
foo_total{a="b"} 17.0 1520879607.789 # {id="counter-test"} 5
73+
foo_total{le="c"} 21.0
74+
foo_created{le="c"} 1520872621.123
75+
foo_total{le="1"} 10.0
76+
```
77+
78+
When the same MetricFamily has multiple label sets with their own CTs we'd have to cram all the timestamps with the additional labels with a delimiter in between.
79+
5580
## Action Plan
5681

5782

0 commit comments

Comments
 (0)