Skip to content

feat: return metric query partial results for drilldown - #18286

Merged
trevorwhitney merged 9 commits into
mainfrom
patterns-partial-results
Jul 2, 2025
Merged

feat: return metric query partial results for drilldown#18286
trevorwhitney merged 9 commits into
mainfrom
patterns-partial-results

Conversation

@trevorwhitney

@trevorwhitney trevorwhitney commented Jun 30, 2025

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

This PR changes the behavior of the max series limitation for metric queries sent from drilldown, allowing those queries to receive partial results with a warning rather than nothing and a 500. The reason we don't do this for all queries is because it introduces non-determininistic results. However, in drilldown we've determined partial results are much more helpful to the user than no results, and still help them drilldown to the logs they care about. Once they've narrowed down what they are looking for, they can switch to explore for deterministic results.

This is very useful for both persisted patterns as well as the histograms for detected fields, both of which can produce more than the limit, but are examples where having some results that my change from query to query is better than having no results that are deterministic.

Which issue(s) this PR fixes:
Fixes #18213 grafana/logs-drilldown#1355
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 changed the title feat: return partial metric queries for drilldown Jun 30, 2025
Comment thread pkg/logql/engine.go
if httpreq.IsLogsDrilldownRequest(ctx) {
// For Logs Drilldown requests, return partial results with warning
vec = vec[:maxSeries]
metadata.FromContext(ctx).AddWarning(fmt.Sprintf("maximum number of series (%d) reached for a single query; returning partial results", maxSeries))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👏

@trevorwhitney
trevorwhitney enabled auto-merge (squash) July 2, 2025 23:02
@trevorwhitney
trevorwhitney merged commit c0c2265 into main Jul 2, 2025
65 checks passed
@trevorwhitney
trevorwhitney deleted the patterns-partial-results branch July 2, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants