Repository navigation
Encode telemetry ping query values - #36
Open
theluckystrike wants to merge 1 commit into
Open
theluckystrike wants to merge 1 commit into
theluckystrike wants to merge 1 commit into
Conversation
The custom query_string_normalizer joined keys and values without encoding them. A fail message such as an exception text with & or # was cut at that character, the rest became a bogus parameter, and a + turned into a space. Cronitor.job sends e.message on failure, so the message shown in Cronitor could lose most of the error. Form-encode every value and every metric in the normalizer and add a spec that decodes the built query string and compares the message, host and metric.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Monitor#pingpasses a customquery_string_normalizerto HTTParty so metrics go out asmetric=foo:1instead ofmetric[]=foo:1. The normalizer joins"#{k}=#{v}"without encoding, so any value with a reserved character is mangled:&ends the value:message=undefined method 'x' for nil & co #42reaches the API asmessage=undefined method 'x' for nilplus a bogusco #42parameter+turns into a space and=inside a value is ambiguoushost,env,seriesand metric valuesCronitor.jobsendse.messageon failure, so exception text that contains these characters showed up cut short in Cronitor.This change form-encodes every value and every metric inside the normalizer (
URI.encode_www_form_component) and keeps themetric=repeat format. Plain values such asrun,completeor a float stamp are sent the same as before.The new spec captures the normalizer from the
HTTParty.getcall, builds the query string and decodes it again. It fails on master (the message comes back asundefined method 'x' for nil) and passes with the change. The full spec suite passes locally (35 examples, 0 failures).