-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Alerting: Improve performance of matching captures #71828
Alerting: Improve performance of matching captures #71828
Conversation
👋 comment /deploy-to-hg to deploy this PR to the hosted Grafana dev environment.
|
Hello @grobinson-grafana!
Please, if the current pull request addresses a bug fix, label it with the |
Hello @grobinson-grafana!
Please, if the current pull request addresses a bug fix, label it with the |
if theseLabels.Equals(cap.Labels) || theseLabels.Contains(cap.Labels) || cap.Labels.Contains(theseLabels) { | ||
if frame.Meta.Custom == nil { | ||
frame.Meta.Custom = []NumberValueCapture{} | ||
fp := theseLabels.Fingerprint() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. PTAL at my comments but they are non-blocking so approving to unblock you.
This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures.
d31c8e0
to
cef8a5c
Compare
This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures. (cherry picked from commit 8dd3eb8)
This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures. (cherry picked from commit 8dd3eb8)
This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures.
* Alerting: Improve performance of matching captures (#71828) This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures. (cherry picked from commit 8dd3eb8) * Add label fingerprints from grafana-plugin-sdk-go * Remove unsafe.StringData as we use Go 1.19 * Fix lint --------- Co-authored-by: George Robinson <george.robinson@grafana.com>
* Alerting: Improve performance of matching captures (#71828) This commit updates eval.go to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures. (cherry picked from commit 8dd3eb8) * Add label fingerprints from grafana-plugin-sdk-go * Remove unsafe.StringData as we use Go 1.19 * Fix lint --------- Co-authored-by: George Robinson <george.robinson@grafana.com>
What is this feature?
This commit updates
eval.go
to improve the performance of matching captures in the general case. In some cases we have reduced the runtime of the function from 10s of minutes to a couple 100ms. In the case where no capture matches the exact labels, we revert to the current subset/superset match, but with a reduced search space due to grouping captures.Benchmarks
All benchmarks are show as before and after benchmarks.
100 alerts
500 alerts
5000 alerts
10,000 alerts
Why do we need this feature?
[Add a description of the problem the feature is trying to solve.]
Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes #
Special notes for your reviewer:
Please check that: