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

Prometheus: Fix exemplars not respecting corresponding series display status. #59743

Merged

Conversation

gtk-grafana
Copy link
Contributor

@gtk-grafana gtk-grafana commented Dec 2, 2022

What is this feature?
Fix bug in which exemplars do not filter when a series is hidden via user clicking on the legend UI.

Currently, when filtering a metric with multiple labels/series via the legend UI, the exemplars do not respect the active filters, and will always display all exemplars in the current time-series graph.

image

image

image

Why do we need this feature?
Users with many labels for a single series in an exemplar query are left with a heap of exemplars that are not differentiated. This PR allows users to hide series from the graph and only view the relevant exemplars.

Who is this feature for?
Users of prometheus exemplars.

Which issue(s) does this PR fix?:
Fixes #59678

Special notes for your reviewer:
This might not be the most clean or efficient solution, please let me know if there's any improvements we can make to this!

Debug snapshot from the TNS app:
histogram_quantile(0.95, sum by(le, job) (rate(tns_request_duration_seconds_bucket[$__rate_interval])))
debug-Exemplar 1 metric 3 labels-2022-12-07 11_53_14.json.txt

@gtk-grafana gtk-grafana changed the title PoC: Working exemplar filtering when series are toggled in legend UI Prometheus: Exemplar filtering with legend UI Dec 5, 2022
@gtk-grafana
Copy link
Contributor Author

Getting closer, although the code is getting messier, but there's still a bug when you're viewing multiple series (by holding shift and clicking), in which only a single label filter is being applied.

@gtk-grafana gtk-grafana marked this pull request as ready for review December 6, 2022 18:26
@gtk-grafana gtk-grafana requested review from a team, codeincarnate and oscarkilhed and removed request for a team December 6, 2022 18:26
@gtk-grafana
Copy link
Contributor Author

The e2e test cases we currently have are only testing a single series, we'll need to revisit our exemplar e2e tests in another issue: #59911.

@gtk-grafana
Copy link
Contributor Author

@itsmylife thanks for the feedback, I've implemented a unit test for the exported function. Can you take another look in the morning?

Copy link
Contributor

@bohandley bohandley left a comment

Choose a reason for hiding this comment

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

Makes sense to me, well done! LGTM!

Copy link
Contributor

@itsmylife itsmylife left a comment

Choose a reason for hiding this comment

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

LGTM but please revert the changes in CHANGELOG.md file.

@gtk-grafana gtk-grafana changed the title Prometheus: Exemplar filtering with legend UI Prometheus: Fix exemplars not respecting corresponding series display status. Dec 8, 2022
@gtk-grafana gtk-grafana merged commit 22f8283 into main Dec 8, 2022
@gtk-grafana gtk-grafana deleted the gtk-grafana/issues/59678/exemplars-not-filtering-from-legend branch December 8, 2022 17:46
grafanabot pushed a commit that referenced this pull request Dec 8, 2022
… status. (#59743)

* Exemplar filtering when series are toggled in legend UI

(cherry picked from commit 22f8283)
gtk-grafana added a commit that referenced this pull request Dec 8, 2022
…s display status. (#60047)

Prometheus: Fix exemplars not respecting corresponding series display status. (#59743)

* Exemplar filtering when series are toggled in legend UI

(cherry picked from commit 22f8283)

Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com>
gtk-grafana added a commit that referenced this pull request Dec 8, 2022
…ies. (#59908)

* Implementing new optional color property to ExemplarMarker component 
* Refactor some changes from #59743
grafanabot pushed a commit that referenced this pull request Dec 8, 2022
…ies. (#59908)

* Implementing new optional color property to ExemplarMarker component
* Refactor some changes from #59743

(cherry picked from commit dfc1516)
gtk-grafana added a commit that referenced this pull request Dec 8, 2022
… time series. (#60054)

Prometheus: Fix exemplar fill color to match series color in time series. (#59908)

* Implementing new optional color property to ExemplarMarker component
* Refactor some changes from #59743

(cherry picked from commit dfc1516)

Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com>
GuYounes pushed a commit to paul-wurth/BIXpert that referenced this pull request Feb 8, 2023
…s display status. (grafana#60047)

Prometheus: Fix exemplars not respecting corresponding series display status. (grafana#59743)

* Exemplar filtering when series are toggled in legend UI

(cherry picked from commit 22f8283)

Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com>
GuYounes pushed a commit to paul-wurth/BIXpert that referenced this pull request Feb 8, 2023
… time series. (grafana#60054)

Prometheus: Fix exemplar fill color to match series color in time series. (grafana#59908)

* Implementing new optional color property to ExemplarMarker component
* Refactor some changes from grafana#59743

(cherry picked from commit dfc1516)

Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com>
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.

Prometheus: Exemplar queries with multiple series in a single metric are not differentiable in the UI
5 participants