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

Fix "job" labels in Grafana dashboards' queries #1199

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

rzetelskik
Copy link
Member

Description of your changes:
Currently there is a bug breaking our Grafana dashboards introduced in #1111. The "job" label in some of the PromQL queries is hardcoded to "scylla", while the ServiceMonitor manifests set it to the value of "scylla/cluster" labels of the identity Service.

For reference see https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor.

This PR fixes it by setting it to a cluster label defined in the ServiceMonitor:

- sourceLabels: [__meta_kubernetes_service_label_scylla_cluster]
. For reference see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#service and https://prometheus.io/docs/prometheus/latest/configuration/configuration/#service.

@rzetelskik rzetelskik added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Apr 4, 2023
@rzetelskik rzetelskik added this to the v1.9 milestone Apr 4, 2023
@rzetelskik rzetelskik requested a review from tnozicka April 4, 2023 07:51
@rzetelskik rzetelskik changed the title Fix job labels in Grafana dashboards' queries Fix "job" labels in Grafana dashboards' queries Apr 4, 2023
@rzetelskik rzetelskik requested a review from zimnx April 4, 2023 08:48
@@ -4602,15 +4602,15 @@ data:
]
},
"datasource": "prometheus",
"definition": "query_result(count(up{job=\"scylla\"}) by (dc))",
"definition": "query_result(count(up{job=~\"$cluster|$^\"}) by (dc))",
Copy link
Member

@tnozicka tnozicka Apr 4, 2023

Choose a reason for hiding this comment

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

can you pls explain the syntax beyond '${cluster}' to me? in particular why the "or" (|) and what $^ means here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I shamelessly copied it over from the other queries - and I suppose you did the same, as it originates from scylla-monitoring dashboards. I actually tried to find something on it in the docs with no success. This essentially substitutes the variables and then matches a regex, so for a cluster named simple-cluster you end up matching e.g. simple-cluster|$^, but I don't see how that's any different than matching just simple-cluster, with or without the regex. @amnonh would you be able to explain? Is that some grafana/prom query magic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I am fine deferring that one and wait for @amnonh's input. Please file an issue to track this and we can merge this at least.

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #1209

@tnozicka tnozicka force-pushed the grafana-dashboards-job-label branch from e83c276 to f7306ad Compare April 6, 2023 06:28
Copy link
Member

@tnozicka tnozicka left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

(better then what we have now an we'll track the regex reasoning in a follow up issue)

@tnozicka tnozicka enabled auto-merge April 6, 2023 06:29
@tnozicka tnozicka merged commit f9eacba into scylladb:master Apr 6, 2023
17 checks passed
@rzetelskik rzetelskik deleted the grafana-dashboards-job-label branch April 11, 2023 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants