Skip to content
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

datatrails: persist search terms and use them to reduce retrieved metric names #87884

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

darrenjaneczek
Copy link
Contributor

@darrenjaneczek darrenjaneczek commented May 15, 2024

What is this feature?

Creates a metric search terms variable.
This variable is stored as a URL parameter, and sent to the prometheus request for metric names.

A limit is added to the prometheus request to prevent an excessive response of metric names, which could lead to a time out. The user is encouraged to add adhoc filters or additional search terms to reduce the number of results returned.

Why do we need this feature?

Three features:

  • store and persist search terms on trail steps
  • use search terms to reduce number of metrics returned
  • set a limit to returned metric names (depends on prometheus version)

Limitations:

  • The types of regular expressions available to the prometheus match[] parameter excludes "lookahead". Instead, we construct a list of expressions out of the search terms, and requests n of those terms to be present in the metric name (where n is the number of search terms). This will result in false positiives, such as "go hello" matching "go_gone" since "go" appears twice. The same javascript regular expression is used as before, which would filter out "go_gone" since it lacks "hello". Unfortunately, the limit will include these false positives.
  • Certain (I assume older) versions of prometheus do not consider the "limit" parameter when requesting metric names.

Special notes for your reviewer:

  • When comparing files, enable the "ignore whitespace option"

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@darrenjaneczek darrenjaneczek self-assigned this May 15, 2024
@grafana-delivery-bot grafana-delivery-bot bot added this to the 11.1.x milestone May 15, 2024
@darrenjaneczek darrenjaneczek changed the title Datatrails/variable search terms datatrails: persist search terms and use them to reduce retrieved metric names May 23, 2024
@darrenjaneczek darrenjaneczek force-pushed the datatrails/variable-search-terms branch 3 times, most recently from 50f08ea to 0a7345c Compare May 28, 2024 13:12
@darrenjaneczek darrenjaneczek force-pushed the datatrails/variable-search-terms branch from e45aa29 to 5915eb8 Compare May 31, 2024 13:26
@darrenjaneczek darrenjaneczek marked this pull request as ready for review May 31, 2024 13:26
@darrenjaneczek darrenjaneczek added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant