Skip to content

[BUGFIX] pyroscope: scope label lookups to the selected service - #835

Merged
AntoineThebaud merged 1 commit into
perses:mainfrom
luweglarz:fix/pyroscope-scope-label-lookups-to-service
Oct 5, 2026
Merged

AntoineThebaud merged 1 commit into
perses:mainfrom
luweglarz:fix/pyroscope-scope-label-lookups-to-service

Conversation

@luweglarz

@luweglarz luweglarz commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

The filter dropdowns in the Pyroscope query editor called LabelNames and LabelValues with only a time range and no matchers. Pyroscope narrows the blocks it reads on service_name alone, so an unscoped lookup scans every block in the range for every service. On a large deployment, one such request fans out into hundreds of internal calls and can exceed the query-backend concurrency limit

Changes

  • computeLabelScopeSelector(service, profileType) builds the selector, andreturns an empty string when no service is set.
  • useLabelNames / useLabelValues send it as matchers, include it in the query key, and stay disabled while it is empty.
  • Filters takes optional service and profileType props and passes the selector to each filter row; the query editor supplies them.
  • The request body type for the two calls now accepts string[] for matchers

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

@luweglarz
luweglarz requested a review from a team as a code owner September 24, 2026 10:10
@luweglarz
luweglarz requested review from Gladorme and removed request for a team September 24, 2026 10:10
@luweglarz
luweglarz force-pushed the fix/pyroscope-scope-label-lookups-to-service branch from 3134c75 to b7a468c Compare September 24, 2026 10:13
@AntoineThebaud
AntoineThebaud requested a balanced review from Copilot September 30, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unescaped selector values can break dropdowns, and both lookup caches can retain results from an earlier time range.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

This PR scopes Pyroscope filter-label lookups to the selected service to avoid expensive unscoped searches.

Changes:

  • Builds a service and optional profile-type selector.
  • Sends that selector with label lookups and disables lookups when no service is selected.
  • Passes the selector through the query editor and filter components.
File Description
pyroscope/​src/​utils/​use-query.ts Adds scoped label requests and query keys.
pyroscope/​src/​utils/​types.ts Builds the lookup selector.
pyroscope/​src/​plugins/​pyroscope-profile-query/​PyroscopeProfileQueryEditor.tsx Passes service and profile type to filters.
pyroscope/​src/​model/​pyroscope-client.ts Allows matcher arrays in request bodies.
pyroscope/​src/​components/​LabelValue.tsx Passes the selector to value lookups.
pyroscope/​src/​components/​LabelName.tsx Passes the selector to name lookups.
pyroscope/​src/​components/​Filters.tsx Computes and distributes the selector.
pyroscope/​src/​components/​FilterItem.tsx Passes the selector to each dropdown.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pyroscope/src/utils/types.ts Outdated
Comment thread pyroscope/src/utils/use-query.ts Outdated
@luweglarz
luweglarz force-pushed the fix/pyroscope-scope-label-lookups-to-service branch from b7a468c to 58b0d80 Compare October 1, 2026 09:07
Signed-off-by: luweglarz <lucas.weglarz@amadeus.com>
@luweglarz
luweglarz force-pushed the fix/pyroscope-scope-label-lookups-to-service branch from 58b0d80 to 19f8599 Compare October 4, 2026 21:30
@AntoineThebaud
AntoineThebaud added this pull request to the merge queue Oct 5, 2026
Merged via the queue into perses:main with commit d06a633 Oct 5, 2026
17 checks passed
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