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: add filter affected services internal endpoint #5415

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

matiasb
Copy link
Contributor

@matiasb matiasb commented Jan 14, 2025

Related to https://github.com/grafana/oncall-private/issues/2977

e.g.

GET /api/plugins/grafana-oncall-app/resources/alertgroups/filter_affected_services?service=service-a&service=service-b

[
  {"name": "service-a",
   "service_url": "http://localhost:3000/a/grafana-slo-app/service/service-a",
   "alert_groups_url": "http://localhost:3000/a/grafana-oncall-app/alert-groups?status=0&status=1&started_at=now-7d_now&label=service_name:service-a"}
]

@matiasb matiasb added pr:no public docs Added to a PR that does not require public documentation updates release:ignore PR will not be added to release notes labels Jan 14, 2025
@matiasb matiasb force-pushed the matiasb/affected-services-endpoint branch from e84e0e5 to 507d9ed Compare January 14, 2025 19:16
@matiasb matiasb marked this pull request as ready for review January 14, 2025 19:34
@matiasb matiasb requested a review from a team as a code owner January 14, 2025 19:34
Copy link
Member

@vstpme vstpme left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

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

LGTM 👍


More out of curiosity, was does "affected" mean in this context? It just means Alert Groups that have a service_name label, right?

Or is it more robust than that and has to do w/ service dependencies? (ie. if Service A depends on Service B and Service B is "degraded", return me Service A).

Also, isn't filter_affected_services mostly just doing label key:value filtering? (if so, don't we have an existing endpoint for this?)

@matiasb
Copy link
Contributor Author

matiasb commented Jan 16, 2025

More out of curiosity, was does "affected" mean in this context? It just means Alert Groups that have a service_name label, right?

Or is it more robust than that and has to do w/ service dependencies? (ie. if Service A depends on Service B and Service B is "degraded", return me Service A).

Also, isn't filter_affected_services mostly just doing label key:value filtering? (if so, don't we have an existing endpoint for this?)

Original implementation would find out upstream service dependencies for service-a and only return those with recent active alert groups (which could be related to a given alert group belonging to service-a). In our first implementation though, frontend will get all service dependencies and this endpoint will filter from there the ones which are affected only (meaning there are recent alert groups with active alert groups), besides returning some additional data (URLs).

Makes sense? Happy to rename as needed.

@joeyorlando
Copy link
Contributor

frontend will get all service dependencies and this endpoint will filter from there the ones which are affected only

ahh okay, makes sense 🙂 thanks!

@matiasb matiasb added this pull request to the merge queue Jan 16, 2025
Merged via the queue into dev with commit 2a87bea Jan 16, 2025
26 checks passed
@matiasb matiasb deleted the matiasb/affected-services-endpoint branch January 16, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates release:ignore PR will not be added to release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants