-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[prometheus] Add support for external_labels #3892
Conversation
Signed-off-by: Adam Chabin <[email protected]>
Signed-off-by: Adam Chabin <[email protected]>
"external_labels": { | ||
"type": "object" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As shown above, you are setting the field nested in server
, not in global
. The schema has to include server.externalLabels
instead. Please, remember to insert the new field in values.yaml
as well with a short comment/reference as seen e.g. at server.remoteRead
.
Co-authored-by: zeritti <[email protected]> Signed-off-by: Adam Chabin <[email protected]>
Signed-off-by: Adam Chabin <[email protected]>
Signed-off-by: Adam Chabin <[email protected]>
Signed-off-by: Adam Chabin <[email protected]>
47d0f77
to
ae3c207
Compare
{{/* | ||
Define prometheus.server.global.externalLabels producing a list of externalLabels | ||
*/}} | ||
{{- define "prometheus.server.global.externalLabels" -}} | ||
{{ toYaml .Values.server.global.externalLabels }} | ||
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The helper template is unnecessary.
{{/* | |
Define prometheus.server.global.externalLabels producing a list of externalLabels | |
*/}} | |
{{- define "prometheus.server.global.externalLabels" -}} | |
{{ toYaml .Values.server.global.externalLabels }} | |
{{- end -}} |
{{- if $root.Values.server.global.externalLabels }} | ||
external_labels: | ||
{{- include "prometheus.server.global.externalLabels" $root | nindent 8 }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The managed field externalLabels
cannot be present in server.global
as the latter gets inserted in Prometheus' config file as is and can therefore only include valid configuration parameters (the change won't pass CI). This is why external_labels
and any other Prometheus' global configuration parameter can currently be set directly through this field.
{{- if $root.Values.server.global.externalLabels }} | |
external_labels: | |
{{- include "prometheus.server.global.externalLabels" $root | nindent 8 }} | |
{{- end }} | |
{{- with $root.Values.server.externalLabels }} | |
external_labels: {{ toYaml . | nindent 8 }} | |
{{- end }} |
## https://prometheus.io/docs/prometheus/latest/configuration/configuration/ | ||
## | ||
externalLabels: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the comment above, needs to be moved out of server.global
in server
.
## https://prometheus.io/docs/prometheus/latest/configuration/configuration/ | |
## | |
externalLabels: {} | |
## https://prometheus.io/docs/prometheus/latest/configuration/configuration/ | |
## | |
externalLabels: {} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions. |
What this PR does / why we need it
Support for external_labels option under global section.
Which issue this PR fixes
When you use multiple Prometheus as agents you would like to add tags like tenant:
external_labels:
tenant: 'tenant1'
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)Special notes for your reviewer
Checklist
[prometheus-couchdb-exporter]
)