make "external_labels" optional on prometheus.yml

Closes-bug: 1944699
Change-Id: I6d0bb3b88983846fdd9c8af09456a106a940d191
This commit is contained in:
zhangmeng 2022-07-20 10:01:25 +08:00 committed by zhangmeng9502
parent 3f8683cccc
commit 41a9402910
4 changed files with 25 additions and 1 deletions

View File

@ -109,6 +109,12 @@ prometheus_services:
volumes: "{{ prometheus_libvirt_exporter_default_volumes + prometheus_libvirt_exporter_extra_volumes }}"
dimensions: "{{ prometheus_libvirt_exporter_dimensions }}"
####################
# Prometheus Server
####################
prometheus_external_labels:
# <labelname>: <labelvalue>
####################
# Database
####################

View File

@ -2,8 +2,12 @@ global:
scrape_interval: {{ prometheus_scrape_interval }}
scrape_timeout: 10s
evaluation_interval: 15s
{% if prometheus_external_labels %}
external_labels:
monitor: 'kolla'
{% for label, value in prometheus_external_labels.items() %}
{{ label }}: {{ value }}
{% endfor %}
{% endif %}
{% if prometheus_alert_rules.files is defined and prometheus_alert_rules.files | length > 0 %}
rule_files:

View File

@ -709,6 +709,12 @@ workaround_ansible_issue_8743: yes
#enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool and nova_compute_virt_type in ['kvm', 'qemu'] }}"
#enable_prometheus_etcd_integration: "{{ enable_prometheus | bool and enable_etcd | bool }}"
# The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).
# prometheus_external_labels:
# <labelname>: <labelvalue>
# By default, prometheus_external_labels is empty
#prometheus_external_labels:
# List of extra parameters passed to prometheus. You can add as many to the list.
#prometheus_cmdline_extras:

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes `monitor: kolla` be added in `external_labels` by default.
Prometheus default config should not include environment-specific
details. In this patch, modify `external_labels` be optional, we
can add any `<labelname>: <labelvalue>` in `external_labels`.
`LP#1944699 <https://bugs.launchpad.net/kolla-ansible/+bug/1944699>`__