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

[o11y] Add default Prometheus Rule to alert off Firefly core metrics #56

Closed
wants to merge 6 commits into from

Conversation

calbritt
Copy link
Contributor

Alerts if the firefly core target is not up.

Alerts if any actions below get rejected:

  • mints
  • transfers
  • burns
  • private messages
  • broadcasts

Resolving this issue - #47

Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
@onelapahead onelapahead changed the title Add default Prometheus Rule to alert off Firefly core metrics [o11y] Add default Prometheus Rule to alert off Firefly core metrics Sep 1, 2022
@onelapahead onelapahead linked an issue Sep 1, 2022 that may be closed by this pull request
Copy link
Contributor

@onelapahead onelapahead left a comment

Choose a reason for hiding this comment

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

This is great thanks for tackling this one @calbritt !

I took at a glance at ingress-nginx for some community guidance and inspiration: https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml#L708-L745

I'll only ask we refactor to have similar pattern of rules but having that be a templatable multi-line string (similar to what we've done for extraContainers for example) rather than a YAML list.

And then the default could be something like:

rules: |
  {{- include "firefly.defaultAlertingRules" . | nindent ... }}

And we move these recommended rules you've made into a helper function. That way folks can reuse our rules and their own if the want, or just completely replace them.

The helper function can refer to values like warningSeverity and other helpers too just like a template which is nice.

charts/firefly/templates/core/prometheusrule.yaml Outdated Show resolved Hide resolved
charts/firefly/values.yaml Outdated Show resolved Hide resolved
charts/firefly/values.yaml Outdated Show resolved Hide resolved
Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
Signed-off-by: Cari Albritton <carialbritton1@gmail.com>
Copy link
Contributor

@onelapahead onelapahead left a comment

Choose a reason for hiding this comment

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

Let's also either add a new ci/ test or update an existing one to include this templating path where the rules are enabled with the default alerts.

Comment on lines +33 to +37
rules: |
{{- include "firefly.defaultPrometheusRules" . | nindent 4 }}
{{- if .Values.core.metrics.prometheusRule.rules }}
{{- tpl .Values.core.metrics.prometheusRule.rules . | nindent 4 }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rules: |
{{- include "firefly.defaultPrometheusRules" . | nindent 4 }}
{{- if .Values.core.metrics.prometheusRule.rules }}
{{- tpl .Values.core.metrics.prometheusRule.rules . | nindent 4 }}
{{- end }}
rules:
{{- tpl .Values.core.metrics.prometheusRule.rules . | nindent 4 }}

Copy link
Contributor

Choose a reason for hiding this comment

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

Note the rules needs to be YAML not a multi-line string, think we just got it criss crossed between here and the values.

enabled: false
criticalSeverity: "critical"
warningSeverity: "warning"
rules: []
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rules: []
rules: |
{{- include "firefly.defaultPrometheusRules" . }}

Copy link
Contributor

Choose a reason for hiding this comment

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

Note this must be a string if passed to tpl, and we don't need to indent because its handled for us when we template the string within the PrometheusRule YAML.

This will allow users to entirely override the rules if they want which is preferred.

@nguyer
Copy link
Contributor

nguyer commented Feb 15, 2024

Closing this PR due to inactivity. Please feel free to re-open if this work is still ongoing.

@nguyer nguyer closed this Feb 15, 2024
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.

PrometheusRules
3 participants