Skip to content

Silence: Wrong HTTP request send by the UI for the preview #2321

Open
@Nexucis

Description

@Nexucis

What did you do?

I have the following alertRule send by Prometheus to the alertManager:

groups:
- name: example
  rules:
  - alert: HighRequestLatency
    expr: vector(1) == 1
    labels:
      severity: page

Using the alertManager UI, I was trying to create a dummy silence with the following matcher:

image

What did you expect to see?
When clicking on the preview button , it should return nothing since the matcher is wrong

What did you see instead? Under which circumstances?
it returns my firing alert
image

That's because the request sent to the backend is not accurate. When clicking on the preview button it sent the following HTTP request:

http://localhost:9093/api/v2/alerts?silenced=true&inhibited=true&active=true

Instead of this one:

http://localhost:9093/api/v2/alerts?filter=alertname%3D%22HighRequestLatency%22&filter=severity%3D%22\%22page\%22%22&silenced=true&inhibited=true&active=true

Or this one:
http://localhost:9093/api/v2/alerts?filter=alertname%3D%22HighRequestLatency%22&filter=severity%3D%22%22page%22%22&silenced=true&inhibited=true&active=true

Not sure exactly which one should be the correct one.

Note: Once the silence is created, it doesn't silence the alertRule fired as expected. I know this is a corner case, but it just tooks me some time to understand why the silence didn't affect the alertRule returned by the button preview.

Environment

  • System information:
    Linux / Windows

  • Alertmanager version:

Tried with alertManager v0.21.0:

$ ./alertmanager.exe --version
alertmanager, version 0.21.0 (branch: HEAD, revision: 4c6c03ebfe21009c546e4d1e9b92c371d67c021d)
  build user:       root@dee35927357f
  build date:       20200617-08:59:53
  go version:       go1.14.4

And with alertManager v0.20.0:

$ ./alertmanager.exe --version
alertmanager, version 0.20.0 (branch: HEAD, revision: f74be0400a6243d10bb53812d6fa408ad71ff32d)
  build user:       root@00c3106655f8
  build date:       20191211-14:18:27
  go version:       go1.13.5
  • Alertmanager configuration file:
    default configuration coming with the tar.gz
global:
  resolve_timeout: 5m

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'web.hook'
receivers:
- name: 'web.hook'
  webhook_configs:
  - url: 'http://127.0.0.1:5001/'
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions