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

Decode plus sign ('+') as a space (' ' or '%20') when decoding silence filters #3946

Open
jmleddy opened this issue Aug 6, 2024 · 0 comments

Comments

@jmleddy
Copy link

jmleddy commented Aug 6, 2024

What did you do?
We added a "silence" link to the pagerduty "details" map for convenience so that users don't have to click through to alertmanager and then re-find the alert they care about and then click the silence button. This uses the go function urlQuery which will become important later.

pagerduty:
  details:
    silence: |-
      https://alertmanager.at.mongodb.com/#/silences/new?filter=%7B
      {{- $first := true }}
      {{- with index .Alerts 0 -}}
        {{- range .Labels.SortedPairs -}}
          {{- if $first }}{{ $first = false }}{{ else }},{{ end -}}
          {{ .Name | urlquery }}%3D%22{{.Value | urlquery }}%22
        {{- end }}
      {{- end -}}%7D

What did you expect to see?

We expect the alerts to match existing alerts that are firing. This works in the vast majority of cases, but increasingly our users are using spaces in their alertnames

What did you see instead? Under which circumstances?

We see alertnames with pluses in them, which does not match any of the firing alerts since the firing alerts have spaces.

Why did you see this?

elm is very opinionated about it. And go templates just happen to use plusses instead of %20

elm/url#32

Where is the patch?
#3945

I just copied the solution from here since it's been a while since
using functional languages and I didn't know the order of the parser,
but I suspect there are much better places to put this, including
repacing in rest var above

elm/url#32 (comment)

Environment

$ uname -s
Linux
  • System information:

  • Alertmanager version:

Fails with later versions as well

Version Information
Branch:
HEAD
BuildDate:
20240228-11:51:20
BuildUser:
root@22cd11f671e9
GoVersion:
go1.21.7
Revision:
0aa3c2a
Version:
0.27.0

  • Prometheus version:

victoria metrics

  • Alertmanager configuration file:
insert configuration here
  • Prometheus configuration file:
insert configuration here (if relevant to the issue)
  • Logs:
insert Prometheus and Alertmanager logs relevant to the issue here
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

1 participant