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

Alerts time range refactor #4240

Merged
merged 8 commits into from
Mar 6, 2024
Merged

Conversation

AdityaHegde
Copy link
Collaborator

@AdityaHegde AdityaHegde commented Mar 5, 2024

This PR updates how we handle time range in alerts.

  • Use the dashboard time range as the query time range.
  • Use splitByGrain for only the alert run interval.
  • Add the time range from dashboard to the the filters section.
  • Fix exclude mode for filters.

@AdityaHegde AdityaHegde requested a review from ericpgreen2 March 5, 2024 07:37
@AdityaHegde AdityaHegde mentioned this pull request Mar 5, 2024
16 tasks
@ericpgreen2
Copy link
Contributor

Some UX items:

  1. It looks like the time range provided to the Data and Alert Previews is All Time, not what's inherited from the dashboard. Here, the All Time vaccinations is 52.5B and the Last 4 weeks vaccinations is 470k.

    image

  2. On the Alert Detail page, can you:

  • Remove "Split by time grain"
  • Add "Evaluation interval" to the right of "Schedule" and show whatever is selected ("None" / "Hourly" / "Daily" / "Weekly") or "X seconds" (if defined through code and not one of the default options)

    image
  1. Rather than this placeholder "None / Hourly / Daily / Weekly", mind switching it so the initial value is "None". Sorry, the Figma mock didn't reflect this.

    image

web-common/src/features/alerts/EditAlertDialog.svelte Outdated Show resolved Hide resolved
@@ -36,14 +41,18 @@ The main feature-set component for dashboard filters
</script>

<div class="relative flex flex-row flex-wrap gap-x-2 gap-y-2 items-center">
{#if timeRange}
<ReadOnlyTimeRange {timeRange} />
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice symmetry with DimensionFilterReadOnlyChip and MeasureFilterReadOnlyChip if this component were named TimeRangeReadOnlyChip

Comment on lines 107 to 117
$: if ($metricsViewSpec?.data && $timeRange?.data) {
const formValues = extractAlertFormValues(
queryArgsJson,
$metricsViewSpec.data,
$timeRange.data,
);
for (const fk in formValues) {
$form[fk] = formValues[fk];
}
console.log(formValues);
}
Copy link
Contributor

@ericpgreen2 ericpgreen2 Mar 6, 2024

Choose a reason for hiding this comment

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

Is this code necessary? Looks like it might have been used for debugging

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. Loading of metrics view spec and time range is async. So we need this to be loaded into the form. The other option is to get the args to the component, but this felt cleaner.

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a comment

Choose a reason for hiding this comment

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

Looks good!

@AdityaHegde AdityaHegde merged commit eba2d6d into main Mar 6, 2024
4 checks passed
@AdityaHegde AdityaHegde deleted the adityahegde/alerts-time-range-refactor branch March 6, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants