Skip to content

Commit

Permalink
Replaced alerting.custom.*.metricLabels with lerting.custom.*.labelMa…
Browse files Browse the repository at this point in the history
…tchers
  • Loading branch information
bastianeicher committed Jul 10, 2023
1 parent 49d3397 commit 7673d21
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/generic-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ app:
| `alerting.grpc.maxCriticalErrors` | `0` | The maximum number of critical gRPC errors responses in the sample interval |
| `alerting.grpc.criticalCodes` | `[Internal, Unimplemented]` | Which gRPC status codes are considered critical errors |
| `alerting.custom.*.metric` | __required if used__ | The name of the Prometheus metric exposed by the service |
| `alerting.custom.*.metricLabels` | `{}` | Labels to use for filtering the metric |
| `alerting.custom.*.labelMatchers` | | Prometheus label matchers to use for filtering the metric (e.g., `some_key="some_value"`) |
| `alerting.custom.*.aggregate` | __required if used__ | The aggregate function to use to combine metric values from multiple replicas (e.g., `max` or `sum`) |
| `alerting.custom.*.increaseOver` | | A sliding window in which to calculate the increase of the metric (e.g., `10m`) |
| `alerting.custom.*.averageOver` | | A sliding window in which to calculate the average value of the metric (e.g., `10m`) |
Expand Down
3 changes: 1 addition & 2 deletions charts/generic-service/ci/custom-alerts-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ alerting:
custom:
MyCustomAlert:
metric: some_metric
metricLabels:
someKey: someValue
labelMatchers: some_key="some_value"
aggregate: sum
predicate: '> 100'
summary: some metric too high
Expand Down
2 changes: 1 addition & 1 deletion charts/generic-service/templates/alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ spec:
{{- if $props.increaseOver }}increase({{ end }}
{{- if $props.averageOver }}avg_over_time({{ end }}
{{ $props.metric | required "alert metric required" }}{
namespace="{{ $.Release.Namespace }}", release="{{ $.Release.Name }}"{{ range $key, $val := $props.metricLabels }}, {{ $key }}={{ tpl $val $ | quote }}{{ end }}
namespace="{{ $.Release.Namespace }}", release="{{ $.Release.Name }}"{{ if $props.labelMatchers }}, {{ tpl $props.labelMatchers $ }}{{ end }}
}
{{- if $props.averageOver }}[{{ $props.averageOver }}]){{ end }}
{{- if $props.increaseOver }}[{{ $props.increaseOver }}]){{ end }}
Expand Down
7 changes: 3 additions & 4 deletions charts/generic-service/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,9 @@
"type": "string",
"description": "The name of the Prometheus metric exposed by the service"
},
"metricLabels": {
"type": "object",
"additionalProperties": {"type": "string"},
"description": "Labels to use for filtering the metric"
"labelMatchers": {
"type": "string",
"description": "Prometheus label matchers to use for filtering the metric (e.g., some_key=\"some_value\")"
},
"aggregate": {
"type": "string",
Expand Down

0 comments on commit 7673d21

Please sign in to comment.