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

Feat: Alerts per check #1011

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft

Feat: Alerts per check #1011

wants to merge 24 commits into from

Conversation

VikaCep
Copy link
Contributor

@VikaCep VikaCep commented Dec 6, 2024

Closes https://github.com/grafana/synthetic-monitoring/issues/186

First iteration of the UI implementation for creating alerts per check.

Some considerations:

  • The design is up for discussion
  • The API is mocked/not deployed in dev.

Screenshots:

  • Edit check screen
    image

  • New check screen
    image

  • Validation errors:
    image

  • POST request

image
  • GET request
image

@VikaCep VikaCep self-assigned this Dec 6, 2024
@VikaCep VikaCep requested a review from a team as a code owner December 6, 2024 20:13
@VikaCep VikaCep requested a review from w1kman December 6, 2024 20:13
@VikaCep VikaCep marked this pull request as draft December 6, 2024 20:20
@VikaCep VikaCep requested a review from ckbedwell December 6, 2024 20:38
@VikaCep VikaCep marked this pull request as ready for review December 10, 2024 21:23
@ka3de
Copy link
Contributor

ka3de commented Dec 11, 2024

Thanks for making time to work on this @VikaCep ! 🙌
I will not make comments on the code because that's beyond my knowledge, but I have a couple of small comments on the UX, I would not consider these as blockers for this PR, but something that we can consider including in the long run.

The first one is that thresholds show no units. I think it could be helpful to specify the units for each threshold, for example whether the threshold refers to a %, or if it is supposed to be defined in seconds (s), milliseconds (ms) or days, etc.

The second one we have already discussed it briefly, personally I think the alerts that support multiple percentiles look better grouped in a single "panel" as the previous iteration? In that case, though, we would need to figure a way to allow users to set different threshold values for the different percentiles, in case that more than one is set, as the same value would probably not make sense for all of them. If we finally opt for this solution and there is something that we have to change in the way the API behaves, let me know and we can work it out also.

Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

I need to do a much more thorough review of the UI/UX but I'd like to explore how we can do that by mocking the data in someway first.

I've focussed mainly on things I can see in the code first that will be agnostic to any of the other changes we'll discuss 😃

src/types.ts Outdated Show resolved Hide resolved
src/components/CheckForm/AlertsPerCheck.tsx Outdated Show resolved Hide resolved
src/data/useCheckAlerts.ts Outdated Show resolved Hide resolved
src/datasource/DataSource.ts Outdated Show resolved Hide resolved
src/page/EditCheck/EditCheck.tsx Outdated Show resolved Hide resolved
const threshold: number = getValues(`alerts.${predefinedAlert.type}.threshold`) || 0;

return (
<Card
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll do a much more thorough review of the UI/UX separately but just a heads up I don't think we should use cards but probably a table of some sort.

@majavojnoska
Copy link

I agree with @ka3de that setting units will clarify what is being measured.

When it comes to the UI, my initial impression was that the cards functioned as radio buttons, allowing only one selection, due to the icon in the top right corner. However, after reviewing Daniel's Slack video, I understand users can set multiple alerts.

A more elegant solution would be to replace the icons with a clear on/off indicator on the left side of each card. This would improve clarity. Also, I would suggest a more condensed card layout to reduce the prominence of the description. Let's discuss this further at our next meeting.

@VikaCep VikaCep requested a review from ckbedwell December 12, 2024 19:51
@VikaCep VikaCep marked this pull request as draft December 16, 2024 12:38
@VikaCep
Copy link
Contributor Author

VikaCep commented Dec 16, 2024

Setting the PR to draft until we settle on the UI/UX changes and address them.

VikaCep added 17 commits January 7, 2025 11:54
- adjust schema validation to make it optional
- add test handlers for new alerts requests
- Also, invalidate cache for fetching fresh check alerts
- Instead of grouping by alert type, I'm displaying all alerts as separate ones
- Grouping by type didn't allow to specify threshold for different percentiles
- since the alerts API is no longer in dev, I'm adding the mocks back to be able to test it
- This should be improved by #850
- Also, adding loading and error states
- Add specific predefined alerts according to the check type in a single constants file
- Display threshold units
@VikaCep
Copy link
Contributor Author

VikaCep commented Jan 7, 2025

After discussing with @majavojnoska and @ckbedwell, we agreed to implement the feature using a structure similar to the Probes selection screen, leveraging a list with checkboxes for selection. After applying the changes, the result now looks as follows:

HTTP Check:

Screen.Recording.2025-01-07.at.16.14.50.mov

Ping Check:
image

All other checks:
image

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.

4 participants