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

Draft
wants to merge 9 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"
  • A "MetricSelect" subdirectory has been added to contain more files related to the function of selecting metrics.

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 2 times, most recently from 4a8f4e8 to 50f08ea Compare May 27, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant