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

Make severity configurable in PrometheusRules #1749

Closed
sebastiangaiser opened this issue May 27, 2024 · 10 comments · Fixed by #1790
Closed

Make severity configurable in PrometheusRules #1749

sebastiangaiser opened this issue May 27, 2024 · 10 comments · Fixed by #1790
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@sebastiangaiser
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently the severity is hardcoded in the PrometheusRules like here

Describe the solution you'd like
It would be great to have them configurable via the Logging CR e.g.:

spec:
  fluentd:
    metrics:
      prometheusRules: true
      severity: my-custom-severity
  fluentbit:
    metrics:
      prometheusRules: true
      severity: my-custom-severity
  syslogNG:
    metrics:
      prometheusRules: true
      severity: my-custom-severity

Describe alternatives you've considered
My current workaround is to disable the PrometheusRules and deploy them in the way I want

Additional context
Logging Operator docs: https://kube-logging.dev/docs/operation/alerting/

@sebastiangaiser
Copy link
Contributor Author

@pepov sorry to ping you but could you please mind have a look :D

@pepov
Copy link
Member

pepov commented Jun 18, 2024

Good idea, but I don't have any free cycles currently. We are looking for contributors to take on "good first issues" like this!

@pepov pepov added the good first issue Good for newcomers label Jun 18, 2024
@pepov pepov modified the milestones: 4.x, 4.8 Jun 18, 2024
@pepov pepov added the help wanted Extra attention is needed label Jun 18, 2024
@aditya7302
Copy link

aditya7302 commented Jun 18, 2024

@pepov I would like to work on this issue. Can you assign it to me ?

@pepov
Copy link
Member

pepov commented Jun 30, 2024

@aditya7302 sure, thanks!

@aditya7302
Copy link

aditya7302 commented Jul 1, 2024

@pepov is this crd is where severity metric should be added to make it configurable ?

@pepov
Copy link
Member

pepov commented Jul 2, 2024

@aditya7302 that is generated from the go code. I recommend to check the Metrics type that could be extended with a severity field and applied everywhere where a prometheusrule is defined, for example here

By looking at the code, my problem is, that using this method we would have to use the same severity for all the prometheusrules that are defined for a single metrics endpoint. For example in case of fluentbit there are two rules defined, one with warning and one with critical severity. How would the proposed severity setting work in this case? 🤔

@sebastiangaiser
Copy link
Contributor Author

sebastiangaiser commented Jul 3, 2024

@pepov @aditya7302 maybe my comment now is a bit controversial to remove the PrometheusRules completely or making the whole Rules block configurable.

@pepov
Copy link
Member

pepov commented Jul 4, 2024

I would add a list based override option that would allow setting overrides for the rules based on the list index. Also we could define a type that would allow overriding other fields as well for the rule.

For example the below metrics config would keep the first rule unmodified but would change a few properties of the second rule.

    metrics:
      prometheusRules: true
      prometheusRuleOverrides: 
        - {}
        - for: 1m
          labels:
             severity: warning
             additionalLabel: b

I think we could also allow a list item to be removed if we set the corresponding item to nil.

@sebastiangaiser
Copy link
Contributor Author

Sounds great 🚀

@aditya7302
Copy link

@pepov I have made some changes to make severity configurable. Please review the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
3 participants