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
Use Kubernetes Recommended Labels #38
Comments
Hey, thanks for trying and opening this issue. I'm sure there a plenty of more things (I have such a long list in my head too), so feel free to continue opening things.
Could you give a bit more context about the labels? Is that just adding the common Kubernetes labels to the generated PrometheusRule CRs?
Therefore I'm not super concerned about the alertname itself, but we can still happily make it configurable. I'll rename this issue to be about the second part of the original comment, as I opened a separate issue for 1. |
Yes, precisely |
Hi! We have a similar use-case. When more than one team use the same Pyrra and Prometheus-operator it's difficult to tell the alert-rules apart and Pyrra can get a little cluttered. Having some customization to include existing labels from Kubernetes and adding new labels as well would be great! pyrra/openapi/client/model_objective.go Lines 18 to 39 in ca43989
From rules.go#L103-L104
Adding a new entry here for custom labels like this for instance
Seems the recording rules are missing namespace as well, since namespace is added automatically to the Pyrra config, but not to the recording rules and therefor not visible in the alert rules. pyrra/openapi/client/model_multi_burnrate_alert.go Lines 17 to 25 in ca43989
For Pyrra (frontend), maybe add some (optional) top-level grouping as well. That way you could add more SLOs for the same team and group them under a team page. |
That sounds very reasonable @hsolberg 👍 |
Thanks for the fast reply! Maybe I should create a separate issue for the frontend part since it's a separate thing? If you prefer to have "user-stories" tickets or specific to what part needs to be changed (frontend or logic for generating alerts for instance). Frontend
Would look something like this example
Alerts apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
name: your-slo-name-here
labels:
prometheus: k8s
role: alert-rules
spec:
target: '99.0'
window: 7d
indicator:
ratio:
errors:
metric: frontend_request_counter_total{status=~"5..",app="app-name"}
total:
metric: frontend_request_counter_total{app="app-name"} Looking at the alert when firing with the rules above (this is the same as the last entry in the table Pyrra shows):
When comparing this to what Pyrra shows in the table, maybe this should be consistent with the labels added to the alert? Also, namespace is missing, but that's only visible in as a label under the objectives name and at the top of the objective you navigate to. Since the alerts are generated it's a bit difficult to name them without being generic as they are now. One solution could be to add the exhaustion to the alertname as well as adding the labels. That way you get a quick overview without having to expand all the alerts in prometheus and use the labels to filter more. Adding namespace would also help with filtering, so maybe something like this?
The last label would be a custom one just to be able to have the target responder for the alert. I didn't want to change too much of how it works now as I'm not a 100% sure of what it ideally would look like. So I'm trying to stick to the bare minimum in the examples and see if anyone else has other views and suggestions. I'll need to think it over some more, but this is the gist of it. 😅 |
Perfect. Thank you for that very in-depth comment. Indeed, we should probably track that in a separate issue to this one. Let's imagine this label is added in here: apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
name: your-slo-name-here
labels:
prometheus: k8s
role: alert-rules
+ team: pyrra
spec:
target: '99.0'
window: 7d
indicator:
ratio:
errors:
metric: frontend_request_counter_total{status=~"5..",app="app-name"}
total:
metric: frontend_request_counter_total{app="app-name"} Then it should show up in the list page of Pyrra too as In the end the same label needs to be part of the alert
I'll open a separate issue and we'll look into it. 👍 |
Hi! A followup question, not sure if it should be asked here or in the closed ticket. |
Good point. I'm not sure why it never came up. |
Hello, and thanks for great tool!
I think it needs two things:
And some controller to ensure rules are in place / removed?
The text was updated successfully, but these errors were encountered: