From d4ecde70713de7ce38ce837200984d831ad874ff Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 26 Nov 2024 03:45:33 +0000 Subject: [PATCH] add future extension to handle type and unit in promql operations Signed-off-by: David Ashpole --- proposals/2024-09-25_metadata-labels.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proposals/2024-09-25_metadata-labels.md b/proposals/2024-09-25_metadata-labels.md index b81dacb..b4d33d5 100644 --- a/proposals/2024-09-25_metadata-labels.md +++ b/proposals/2024-09-25_metadata-labels.md @@ -64,7 +64,7 @@ Users see no difference to exposition formats. When a query for a metric returns multiple metrics with a different `__type__` or `__unit__` label, but the same `__name__`, an info annotation will be returned with the PromQL response, which is otherwise unmodified. -Aggregations and label matches ignore `__unit__` and `__type__` and any operation would remove the `__unit__` and `__type__` label (with the exception of label_replace). +Aggregations and label matches ignore `__unit__` and `__type__` and any operation removes the `__unit__` and `__type__` label (with the exception of `label_replace`). ### Prometheus UI Changes @@ -147,6 +147,10 @@ The `_count` series of histograms and summaries could omit the `__unit__` label ## Potential Future Extensions +### Handling __type__ and __unit__ in PromQL operations + +Initially, aggregations and label matches will ignore `__unit__` and `__type__` and all PromQL operations remove the `__unit__` and `__type__` label (with the exception of `label_replace`). Over time, we can update each function to keep these labels by implementing the appropriate logic. For example, adding two gauges together should yeild a gauge. + ### __type__ and __unit__ from client libraries One obvious extension of this proposal would be for Prometheus clients to start sending `__type__` and `__unit__` labels with the exposition format. This would: