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

@ahoppen ahoppen commented May 22, 2026

Copy link
Copy Markdown

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

ahoppen commented Jun 1, 2026

Copy link
Copy Markdown
Author

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

ahoppen commented Jun 5, 2026

Copy link
Copy Markdown
Author

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

ahoppen commented Jun 5, 2026

Copy link
Copy Markdown
Author

Updated the PR to remove the configuration options.

@ktoso

ktoso commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Just chiming in to say this looks good! Agree on not doing tens of settings in the lib itself, collectors can handle that 👍

@ktoso ktoso added the 🔨 semver/patch No public API change. label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants