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

Allow rule labels with slash #180

Closed
gordonbondon opened this issue Mar 21, 2019 · 7 comments
Closed

Allow rule labels with slash #180

gordonbondon opened this issue Mar 21, 2019 · 7 comments

Comments

@gordonbondon
Copy link

Spec for PrometheusRule notes that labels may match selectors of replication controllers and services. According to this labels like app.kubernetes.io/name are recommended for kubernetes. But apparantly / is not allowed here and I get errors like this:

level=error ts=2019-03-21T14:32:57.642600466Z caller=manager.go:754 component="rule manager" msg="loading groups failed" err="group \"analytics-csgo-stats-api-dev.rules\", rule 0, \"5xxErrors\": invalid label name: app.kubernetes.io/name"
@brian-brazil
Copy link
Contributor

You've got the wrong repo, you're looking for the Prometheus Operator.

@gordonbondon
Copy link
Author

Operator does not validate rules itself. So I get this error when rule is added prometheus config and probably bparsed by this package here.

I understand that prometheus is not part of kubernetes but still,
is it possible to allow / symbols so it's possible to use such labels? Or there is some limitation?

@brian-brazil
Copy link
Contributor

The characters allowed in labelnames will not change from a Prometheus standpoint. This does sound like an Operator issue.

@gordonbondon
Copy link
Author

Sorry, I did not provide more details. I was meant rules labels like here:

- name: somename
      rules:
        - alert: "AnalyticsCsgoStats5xxErrors" 
          annotations:
            description: "Increased 5xx error rate on {{ $labels.namespace }}/{{ $labels.service }}"
            expr: increase(analytics_csgo_stats_http_responses_total{code=~"5.*"}[1m]) > 0
          for: "5m"
          labels:
            severity: "warning"
            app.kubernetes.io/name: app-name

Currently, we have to switch app.kubernetes.io/name to app because / is not allowed.

@brian-brazil
Copy link
Contributor

brian-brazil commented Mar 21, 2019 via email

@gordonbondon
Copy link
Author

Ok, I understand that it's not possible to change this. Thanks.

alanprot pushed a commit to alanprot/common that referenced this issue Mar 15, 2023
Improve handling of canceled calls in logging, metrics and tracing.
@abdennour
Copy link

any update ? we have label naming conventions for k8s, and we wanna use same for prom rule labels

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

No branches or pull requests

3 participants