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.

Comment thread Sources/AsyncHTTPClient/TracingSupport.swift Outdated
@ahoppen
Copy link
Copy Markdown
Author

ahoppen commented Jun 1, 2026

Added the more scoped logging and configuration options to opt into full URL logging and to opt out to path logging.

I chose to mark DeconstructedURL as @usableFromInline so that I can use it for the structured field tracing. Let me know if there’s an issue with that.

@czechboy0
Copy link
Copy Markdown

I think url.full should be enabled by default, following OpenTelemetry standard attributes: https://opentelemetry.io/docs/specs/semconv/registry/attributes/url/#url-full

Almost any string field can, in theory, have PII, and I think this is the wrong place to try to make that call. Let application owners filter PII in their telemetry backends instead.

@ahoppen
Copy link
Copy Markdown
Author

ahoppen commented Jun 5, 2026

I think url.full should be enabled by default, following OpenTelemetry standard attributes

Are you suggesting that we don’t have any configuration options for this in async-http-client? I personally don’t have an opinion either way.

@czechboy0
Copy link
Copy Markdown

That's right. That's both how OpenTelemetry and the Swift observability libraries are designed.

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.
@ahoppen
Copy link
Copy Markdown
Author

ahoppen commented Jun 5, 2026

Updated the PR to remove the configuration options.

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.

3 participants