-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
outputs/warp10: url encode comma in tags value #8657
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
plugins/outputs/warp10/warp10.go
Outdated
value := strings.Replace(tag.Value, ",", "%2C", -1) | ||
tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about query escaping this with the same function used for URL encoding, so all special characters are handled? you could do this for the tag key as well.
value := strings.Replace(tag.Value, ",", "%2C", -1) | |
tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) | |
value := url.QueryEscape(tag.Value) | |
tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, it might be better indeed. After looking again at the Warp10 specification, it seems that both tag key and value should be url encoded, I just didn't encounter an issue with it. But at the same time, most of the characters would be fine, only ,
, {
and }
would be a real issue.
I think I'll adapt your commit to url encode the key too, would that be okay? Or I can commit your changes if you prefer to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both is fine for @ssoroka. Will remove the "ready-to-merge" label and wait for your changes... :-) Thanks for taking care of this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll make the changes withing a few days, thanks :)
0d429ad
to
822c846
Compare
822c846
to
0c45935
Compare
I rebased this branch onto master and I amended the commit to also url encode the tag key. Let me know if there is anything else I should do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
(cherry picked from commit f09e551)
Hello,
The warp10 specification requires the commas in tag values to be URL encoded as
%2C
. This PR fixes this behavior.I'm not very familiar with Golang, let me know if there is anything I should do better.
EDIT: Without this, Warp10 will reject the input and reply a parse error. This is the case with the current Elasticsearch input plugin for example.
Required for all PRs: