-
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: Make Loki & Prometheus instant vector by default #66797
Conversation
Backend code coverage report for PR #66797 |
Frontend code coverage report for PR #66797
|
I'll double check with the alerting BE team if the feature flag is relevant to us, the |
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.
I reviewed loki
part of change and added feedback. Let me know what do you think!
f213a30
to
eb6f806
Compare
public/app/features/alerting/unified/components/expressions/Expression.tsx
Show resolved
Hide resolved
public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx
Show resolved
Hide resolved
public/app/features/alerting/unified/components/expressions/Expression.tsx
Outdated
Show resolved
Hide resolved
public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx
Show resolved
Hide resolved
@@ -261,6 +260,9 @@ export function getThresholdsForQueries(queries: AlertQuery[]) { | |||
// now also sort the threshold values, if we don't then they will look weird in the time series panel | |||
// TODO this doesn't work for negative values for now, those need to be sorted inverse | |||
thresholds[refId].config.steps.sort((a, b) => a.value - b.value); | |||
|
|||
// also make sure we remove any "undefined" values from our steps in case the threshold config is incomplete | |||
thresholds[refId].config.steps = thresholds[refId].config.steps.filter((step) => step.value !== undefined); |
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.
is this change needed for this PR changes? or you added as an improvement?
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.
Not strictly need, it fixes a small bug I found while testing my changes where an incomplete threshold definition (like is between 0 and <undefined>
would break the time series visualization and show a blank canvas.
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!🚀
I added some non-blocking comments
public/app/features/alerting/unified/components/rule-viewer/RuleViewerVisualization.tsx
Outdated
Show resolved
Hide resolved
Great job. Visualizations are handled much better now! |
{({ width }) => ( | ||
<div style={{ width }}> | ||
{isTimeSeriesData ? ( | ||
<GraphContainer |
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.
It looks like PanelRenderer
has built-in error handling. As we no longer use it we need to handle error on our own
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.
Yea valid concern; unfortunately we have to choose between; Instant vector – better for querying as fewer data is transferred and is faster, but not time series viz Unless we figure out how to rewrite queries I don't see how we could have both :( |
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! Great job!
What is this feature?
This feature makes the following changes to Alerting:
Non-visually
getDefaultQuery()
for datasourcesinstant
responses by default in AlertingVisually
table
andstat
visualisations as these were broken for dataframes with lots of labelsnumeric-multi
)<GraphContainer />
from the explore view since it has a few features that are useful in Alerting<ExpressionResult />
component to rendernumeric-multi
dataframes<ExpressionResult />
to syntax color labels<GrafanaRuleQueryViewer />
And makes the following changes to other parts of Grafana that aren't Alerting:
<GraphContainer />
to support thresholdsonDataSourceLoaded()
hook to<QueryEditorRow />
Why do we need this feature?
This would reduce to TCO for Loki and Mimir by no longer querying a range of data for each alert rule evaluation.
Which issue(s) does this PR fix?:
Fixes #
Special notes for your reviewer:
Setting this to draft for now until I can figure out how to write some tests for some of the most important bits here.