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

Rule: upgrade to v0.33.0: error in thanos url template #7002

Closed
ahurtaud opened this issue Dec 21, 2023 · 2 comments · Fixed by #7009
Closed

Rule: upgrade to v0.33.0: error in thanos url template #7002

ahurtaud opened this issue Dec 21, 2023 · 2 comments · Fixed by #7009

Comments

@ahurtaud
Copy link
Contributor

Thanos, Prometheus and Golang version used:
thanos v0.33.0

What happened:
Upgrading from v0.32 to v0.33.0, the thanos url advertised by our ruler cannot be opened back in thanos query anymore.
I think this is due to #6308

What you expected to happen:
Thanos urls to be clickable as before

How to reproduce it (as minimally and precisely as possible):
We have not changed anything so it is using the default:
--alert.query-template="/graph?g0.expr={{.Expr}}&g0.tab=1"

Anything else we need to know:
I think this is due to some html encoding of spaces:
we are seeing urls like:
https://<redacted>/graph?g0.expr=%28max&#43;by&#43;%28namespace%2C&#43;pod%2C&#43;instance%2C&#43;container%29&#43;%28increase%28kube_pod_container_status_restarts_total%7Bnamespace%21~%22openshift-gitops%7Copenshift-marketplace%7Copenshift-pipelines%22%2Cprometheus%3D%22platform%22%7D%5B1h%5D%29%29&#43;%3E%3D&#43;4%29&g0.tab=1

url decode:
Screenshot 2023-12-21 at 15 49 08

When clicking on it, thanos query, opens it with:
Screenshot 2023-12-21 at 15 51 05

https://<redacted>/graph?g0.expr=%20(max&g0.tab=1&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=%5B%5D&g0.engine=thanos&g0.analyze=0

@ahurtaud
Copy link
Contributor Author

I think of an issue between difference of url encode and html encode :/
spaces becoming: &#43; instead of %20 for example

@kartikaysaxena
Copy link
Contributor

kartikaysaxena commented Dec 26, 2023

From what I get, we are using url.QueryEscape(expr) in tableLinkForExpression which may be the cause of it as it escapes certain special characters including + (for space) although we have to convert it into %20. Not doing so it in the first place makes it &#43;

Edit: When the expression with + is passed in a new template, it makes the + &#43; instead of %20.
Reference

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

Successfully merging a pull request may close this issue.

2 participants