-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: remove request URI query params from emitted url.path #269
Conversation
Add urlshaper to the project, use it to parse path of the request URI.
urlshaper does the job for removing parameters from request URIs. I stopped changing code at the point where it did what #214 described: no query params in the We could put them in urlshaper's Shape field is tempting, too, with its "query param values transformed into '?'" as output. There's no semconv-named field for that kind of value, though. |
handlers/libhoney_event_handler.go
Outdated
@@ -155,7 +158,10 @@ func (handler *libhoneyEventHandler) handleEvent(event assemblers.HttpEvent) { | |||
ev.AddField(string(semconv.HTTPRequestBodySizeKey), event.Request.ContentLength) | |||
if handler.config.IncludeRequestURL { | |||
requestURI = event.Request.RequestURI | |||
ev.AddField(string(semconv.URLPathKey), requestURI) | |||
urlShape, err := handler.urlParser.Parse(requestURI) |
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.
How do you feel about always adding the templated path and then using the new IncludeRequesURL
config option to add in the original url?
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.
Templated path is not something we've got yet without accepting regexes from the user to know how to parse out the variable bits of a path. 😞
This reverts commit 788851d.
No need (yet) for an external dependency to parse URI for the path.
Here's a go at emitting strictly the |
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.
## Which problem is this PR solving? Now we strip query string parameters from the Url in #269, we can more safely default to recording HTTP URL. The option is still be available to opt-out if desired. - Closes #280 ## Short description of the changes - Change default value of IncludeRequestURL config option to `true` - Update unit tests ## How to verify that this has the expected result The agent's default behaviour to to record HTTP request URLs. The can be disabled via setting the config option to false.
Which problem is this PR solving?
Short description of the changes
url.path
url
package for URL parsing and emit only the path portion of the URI forurl.path
How to verify that this has the expected result
No more content after a # or a ? in a URL sent for
url.path
!