8000 PROM-39: Provide PromQL info annotations when rate()/increase() over series without `__type__`="counter" label by ArthurSens · Pull Request #16632 · prometheus/prometheus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PROM-39: Provide PromQL info annotations when rate()/increase() over series without __type__="counter" label #16632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025

Conversation

ArthurSens
Copy link
Member

Part of #16610

This PR implements PromQL warning when performing rate() and increase() over series without the correct __type__ label.

@ArthurSens ArthurSens requested a review from roidelapluie as a code owner May 26, 2025 23:11
@ArthurSens ArthurSens changed the title Provide PromQL info annotations when rate()/increase() over series without __type__="counter" label PROM-39: Provide PromQL info annotations when rate()/increase() over series without __type__="counter" label May 26, 2025
Copy link
Contributor
@fionaliao fionaliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions:

  1. Should we add the warning in the case there's no type label? Currently that's what's happening. I'm worried that might be noisy. In a perfect world, all metrics will have a type label. But if only a subset of the traffic has the type label, these warnings could just get in the way for the non-type-label traffic. Or if they've recently started using type and unit metadata labels, their old series will be missing these labels and queries over longer periods of time could return warnings.

  2. Is it worth splitting out the query type checks to a separate flag? I could imagine in a migration scenario, people first start manually adding type and unit metadata labels to a subset of of the metrics rather than enabling type and unit metadata labels to be added automatically upon ingestion, as the latter would affect all their metrics. So they might only want the query-time checks first. This relates to the first question - in a scenario where there's a phased migration it's likely a portion of the metrics will be missing the type label.

@ArthurSens
Copy link
Member Author
  1. Should we add the warning in the case there's no type label? Currently that's what's happening. I'm worried that might be noisy. In a perfect world, all metrics will have a type label. But if only a subset of the traffic has the type label, these warnings could just get in the way for the non-type-label traffic. Or if they've recently started using type and unit metadata labels, their old series will be missing these labels and queries over longer periods of time could return warnings.

Yeah, I was not really sure what to do in the event of the absence of those labels. I feel we should warn in the case of absence. It's not the situation right now, but the proposal aims to add those labels when ingesting metrics from all possible ways metrics could be ingested:

  • Scrape
  • OTLP receiver
  • RW receiver

So, by the time the feature flag is ready to be promoted to stable, a metric cannot be ingested without those labels. I agree that while development is ongoing, the experience won't be perfect, but maybe that's an okay trade-off (that we don't need to care about this in the future)?

  1. Is it worth splitting out the query type checks to a separate flag? I could imagine in a migration scenario, people first start manually adding type and unit metadata labels to a subset of of the metrics rather than enabling type and unit metadata labels to be added automatically upon ingestion, as the latter would affect all their metrics. So they might only want the query-time checks first. This relates to the first question - in a scenario where there's a phased migration it's likely a portion of the metrics will be missing the type label.

I'd like to avoid another feature flag if possible. A PromQL warning is just a highlight in the UI; query results are still returned, and everything works as always. The more feature flags we introduce, the more work we'll have in the future to migrate folks who haven't enabled them before and it creates more cognitive load for users trying to understand which toggles to switch to have what they want 😬

…thout counter label

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens force-pushed the type-unit-promql-warnings branch from a306b1b to 56e09ac Compare May 29, 2025 18:26
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens force-pushed the type-unit-promql-warnings branch from 56e09ac to 1ef361b Compare May 29, 2025 18:28
Copy link
Contributor
@fionaliao fionaliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay let's try it this way - if people think the warning is too noisy we can always adjust it 👍

@ArthurSens ArthurSens merged commit 8d0a747 into main Jun 6, 2025
45 checks passed
@ArthurSens ArthurSens deleted the type-unit-promql-warnings branch June 6, 2025 13:01
!strings.HasSuffix(metricName, "_sum") ||
!strings.HasSuffix(metricName, "_count") ||
!strings.HasSuffix(metricName, "_bucket") {
// Fallback to name suffix checking
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should be above the check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0