Skip to content

feat: hide __aggregated_metric__ in /series and /labels - #14677

Merged
trevorwhitney merged 6 commits into
mainfrom
remove-agg-metric-from-series-response
Apr 24, 2025
Merged

feat: hide __aggregated_metric__ in /series and /labels#14677
trevorwhitney merged 6 commits into
mainfrom
remove-agg-metric-from-series-response

Conversation

@trevorwhitney

@trevorwhitney trevorwhitney commented Oct 30, 2024

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

This PR removes {__aggregated_metric=~".+"} streams from the /series endpoint, unless an __aggregated_metric__ matcher is explicitly requested. It does the same for /labels, so __aggregated_metric__ will not appear in a /labels response, but you can still request /labels/__aggregated_metric__/values.

This will alleviate confusion for people using a tool like logcli series --analyze-labels for cardinatlity analysis.

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
@trevorwhitney
trevorwhitney requested a review from a team as a code owner October 30, 2024 22:51
@trevorwhitney trevorwhitney changed the title feat: hide __aggregated_metrics__ in /series and /labels Oct 30, 2024
Comment thread pkg/loki/modules.go Outdated
return nil, err
}

if t.Cfg.Pattern.MetricAggregation.Enabled {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This works if running Loki all-in-one or sharing a config file, but I don't think it will work if the pattern-ingester and querier are running as separate components and this cfg is set using a flag on the pattern-ingester so the querier doesn't see it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

True, but since we already follow this pattern in many other places I think we've already created a dependency on a shared config file.

Would your preference be we specify -querier.metric_aggregation_enabled as a command line flag as well (as opposed to hiding it)?

@trevorwhitney

Copy link
Copy Markdown
Collaborator Author

I'm closing this for now, we'll see if we want it again in the future

@chaudum
chaudum deleted the remove-agg-metric-from-series-response branch December 20, 2024 10:33
@trevorwhitney
trevorwhitney restored the remove-agg-metric-from-series-response branch March 26, 2025 16:42
@trevorwhitney

Copy link
Copy Markdown
Collaborator Author

and it's come up again 😺

@trevorwhitney trevorwhitney reopened this Apr 24, 2025
@github-actions github-actions Bot added sig/operator area/helm type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories labels Apr 24, 2025
@trevorwhitney
trevorwhitney force-pushed the remove-agg-metric-from-series-response branch from bc95f88 to b90f4d2 Compare April 24, 2025 16:17

@svennergr svennergr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we used the presence of a __aggregated_metric__ label as the indicator that we can use aggregated metrics. How would we do that in the future? Just rely on the feature flag?
cc @gtk-grafana

@trevorwhitney

trevorwhitney commented Apr 24, 2025

Copy link
Copy Markdown
Collaborator Author

@svennergr could you point me to code, do you know if we search explicitly for that label vs just hitting /labels? This PR still allows /label/__aggregated_metric__/values, which could be a simple solution?

Relying on the feature flag seems reasonable to me as well.

@svennergr

Copy link
Copy Markdown
Contributor

@svennergr could you point me to code, do you know if we search explicitly for that label vs just hitting /labels? This PR still allows /label/__aggregated_metric__/values, which could be a simple solution?

Relying on the feature flag seems reasonable to me as well.

I think I'm working too much with LLMs nowadays. I hallucinated - we don't look for that in /labels response. Thanks and sorry, @trevorwhitney!

@trevorwhitney
trevorwhitney merged commit 4b0aaaa into main Apr 24, 2025
@trevorwhitney
trevorwhitney deleted the remove-agg-metric-from-series-response branch April 24, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/helm sig/operator size/L type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories

3 participants