Skip to content

feat: return metric query partial results for drilldown #18286

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trevorwhitney
Copy link
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

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
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

Choose a reason for hiding this comment

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

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants