Skip to content

Commit

Permalink
Add cluster-info recording rule
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBisson committed Oct 12, 2023
1 parent 3fb9947 commit 1470252
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add recording rules to list all clusters.

## [2.138.1] - 2023-10-11

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,40 @@ spec:
record: aggregation:giantswarm:app_upgrade_available
- name: clusters.grafana-cloud.recording
rules:
# This recording rule is used to list all clusters. The last expression is used to list vintage MCs
- expr: |-
avg by (cluster_id, customer, installation) (
label_replace(
capi_cluster_info,
"cluster_id",
"$1",
"name",
"(.*)"
)
or cluster_operator_cluster_status
or cluster_service_cluster_info
or
label_replace(
label_replace(
label_replace(
vector(1),
"cluster_id",
{{ .Values.managementCluster.name | quote }},
"",
""
),
"customer",
{{ .Values.managementCluster.customer | quote }},
"",
""
),
"installation",
{{ .Values.managementCluster.name | quote }},
"",
""
)
)
record: aggregation:giantswarm:cluster
- expr: sum(label_replace(azure_operator_cluster_release{release_version!=""}, "cluster_id", "$1", "exported_cluster_id", "(.*)")) by (release_version, cluster_id) or sum(cluster_service_cluster_info) by (release_version, cluster_id) / 2 or sum(cluster_operator_cluster_status{release_version!=""}) by (release_version, cluster_id)
record: aggregation:giantswarm:cluster_release_version
- expr: avg_over_time(cluster_operator_cluster_create_transition[1w]) or avg_over_time(azure_operator_cluster_create_transition[1w])
Expand Down
6 changes: 6 additions & 0 deletions helm/prometheus-rules/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"managementCluster": {
"type": "object",
"properties": {
"customer": {
"type": "string"
},
"name": {
"type": "string"
},
Expand All @@ -14,6 +17,9 @@
"provider": {
"type": "object",
"properties": {
"flavor": {
"type": "string"
},
"kind": {
"type": "string"
}
Expand Down
1 change: 1 addition & 0 deletions helm/prometheus-rules/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project:
branch: '[[ .Branch ]]'
commit: '[[ .SHA ]]'
managementCluster:
customer: ""
name: ""
pipeline: ""
provider:
Expand Down

0 comments on commit 1470252

Please sign in to comment.