Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Graphite template URL from query string/target pairs should not be escaped #280

Closed
streadway opened this issue Jan 15, 2015 · 4 comments · Fixed by #283
Closed

Graphite template URL from query string/target pairs should not be escaped #280

streadway opened this issue Jan 15, 2015 · 4 comments · Fixed by #283
Labels

Comments

@streadway
Copy link

Reproduction:

Show template variables
Add template variable xxx to be packets_received
Add Frame with URL http://graphite/render/?target=stats_counts.statsd.packets_received
Verify graph shows something
Click on Frame Source
In target field, replace packets_received with template variable {{xxx}}

Actual:

Graph no longer shows No Data
Frame Source is now:

http://graphite/render/?target=stats_counts.statsd.%7B%7Bxxx%7D%7D

Expected:

To show the same graph without the template variable
Frame Source to not escape the template braces:

http://graphite/render/?target=stats_counts.statsd.{{xxx}}
@streadway
Copy link
Author

This happen in both directions, also when directly editing the frame source URL or the breakout query parameters.

@juliusv
Copy link
Contributor

juliusv commented Jan 19, 2015

@streadway Thanks for the report!

@stuartnelson3 This would be great to fix soon (mid to high priority).

@streadway
Copy link
Author

In the meantime for those that run into this, I have this in my history:

pbpaste | sed -e 's/%7D%7D/}}/g' -e 's/%7B%7B/{{/g' | pbcopy

After the escaping happens, I copy the frame source, run that command then paste it again.

@grobie
Copy link
Contributor

grobie commented Jan 19, 2015

It's necessary to escape the parameters before constructing a URL. For a simple target with only a metric name this might work, for targets including functions with parentheses, spaces, equal signs or even ampersands, not escaping will break the URL.

It might be possible to postpone the escaping until after template variables have been evaluated and the request gets sent to graphite, but that depends on how the graphite URL gets stored internally. With the new graphite data source editor, it has to be ensured that repeated decomposing/composing of the parameters does not mutate the URL.

It seems to me that this issue is not so much about escaping but handling of template variables in graphite URLs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants