prometheus-config
prometheus-config copied to clipboard
"customer" variable need to be an annotation, not a label
Issue Summary Hi there ! I was tring to deploy Alerta, and lost sometime on the customer field. As the documentation says here, the customer field need to be in the label section, which seems to be logical, but its was not working. To get the customer field ok, I had to add it as an "annotation".
Environment
-
OS: linux
-
API version: 8.1.0
-
Deployment: Helmchart (Kubernetes)
-
Database: Postgres
-
Server config: Auth enabled? Yes Auth provider? Basic Customer views? No
alerta@alert-poc-alerta-f579f95f-mchv7:/$ alerta version
alerta 8.1.0
alerta client 8.0.0
requests 2.25.0
click 7.1.2
To Reproduce Steps to reproduce the behavior:
- Deploy a PrometheusRule with the customer field in the label section
- Nothing will be display in the customer field
- Add it to annotations, the field will be ok
Expected behavior Add the customer field in the labels, not annotation section
Same problem. The field customer
is empty in alerta using a label in prometheus alert.
I use Docker image alerta/alerta-web:8.7.0
.
$ alerta version
alerta 8.7.0
alerta client 8.5.1
requests 2.26.0
click 8.0.3
It's curious because the prometheus webhook seems correct : https://github.com/alerta/alerta/blob/v8.7.0/alerta/webhooks/prometheus.py#L49
environment = labels.pop('environment', current_app.config['DEFAULT_ENVIRONMENT'])
customer = labels.pop('customer', None)
The customer field was introduced in alerta on Jan 11, 2019 by this commit, and always filled from the label:
https://github.com/alerta/alerta/commit/aeb600dedff706452a7f6285986424dee20e748c
It seems that the field is correct for the alert object : we can see the correct value for the customer
field in the AJAX requests that loaf alerts list, and in the data tab of the alert page.
It is a display bug in the web UI.
My UI is translated in french, can it be the cause ?
No : I changed the application settings to set the language as english, and the customer
column is still empty.
Solved by adding CUSTOMER_VIEWS = True
in alerta configuration.
Not sure that it should be the correct behaviour. CUSTOMER_VIEWS
is planned for multi-tenancy. But we want to see the value in customer column event without multi-tenancy.
To see if this condition is relevant: https://github.com/alerta/alerta-webui/blob/master/src/components/AlertList.vue#L218
<span v-if="col == 'customer' && $config.customer_views">
Hello,
I have the same problem with the customer label. When I put the customer as annotation, I have the value displayed in alerta_webui but it is impossible to filter by customer from the link https://alerta*/customers (the customer value don't match). Indeed, with the annotation setting, there are 2 "Customer" fields : one empty, the second with the annotation value.
Moreover, alertad receives the value of the client annotation (with the debug mode in alertad.conf) but the postgres "alerts" table does not contain the client value (the column is empty for all alerts).
When I set the both values in the same time (annotation and label, I don't receive the alerts).
The customer filtering don't work.
alertad : 8.7.0