Skip to content

Set url.full attribute on spans logged for HTTP requests#906

Open
ahoppen wants to merge 1 commit into
swift-server:mainfrom
ahoppen:set-url-span
Open

Set url.full attribute on spans logged for HTTP requests#906
ahoppen wants to merge 1 commit into
swift-server:mainfrom
ahoppen:set-url-span

Conversation

@ahoppen
Copy link
Copy Markdown

@ahoppen ahoppen commented May 22, 2026

We previously only set the request method on these spans, which made it hard to identify which exact HTTP request was causing this span to be emitted.

Also record the URL of the HTTP request to add more information to these spans. While at it, also record the request body size because we already had an attribute key configured for it.

handleRequestTracingAttributes(
span,
requestMethod: request.method.rawValue,
url: request.url.description,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to be careful with that. The full URL can include PII.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. What do you think of the following: Only log only the host name by default. I wouldn’t consider that as PII and it might already give a hint as to what's being requested. We then add a configuration option to TracingConfiguration that allows users to opt into recording the entire URL in traces.

We previously only set the request method on these spans, which made it hard to identify which exact HTTP request was causing this span to be emitted.

Also record the URL of the HTTP request to add more information to these spans. While at it, also record the request body size because we already had an attribute key configured for it.
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 this pull request may close these issues.

2 participants