Skip to content

fix(core): strip trailing colon from url.scheme span attribute - #26435

Draft
okxint wants to merge 2 commits into
getsentry:developfrom
okxint:fix/url-scheme-strip-protocol-colon
Draft

okxint wants to merge 2 commits into
getsentry:developfrom
okxint:fix/url-scheme-strip-protocol-colon

Conversation

@okxint

@okxint okxint commented Nov 16, 2026

Copy link
Copy Markdown

URL.protocol always includes a trailing colon (e.g. 'https:') but the OpenTelemetry url.scheme semantic convention specifies just the scheme without the colon (e.g. 'https').

packages/browser-utils already stripped the colon correctly in browserMetrics.ts with an explicit comment:

// the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it.
attributes['url.scheme'] = parsedUrl.protocol.split(':').pop();

packages/node also strips it correctly in undici-instrumentation.ts:

const urlScheme = requestUrl.protocol.replace(':', '');

The two remaining sites that assigned urlObject.protocol directly — getHttpSpanDetailsFromUrlObject in packages/core/src/utils/url.ts and the Bun server integration — were left unpatched. This caused every HTTP span created via those paths to emit a malformed url.scheme value with a trailing colon.

The fix applies the same .replace(':', '') in both locations and updates the 18 test assertions that expected the wrong value.

okxint added 2 commits August 1, 2026 15:38
URL.protocol always includes a trailing colon (e.g. 'https:') but the
OpenTelemetry url.scheme semantic convention specifies just the scheme
without the colon (e.g. 'https').

packages/browser-utils already stripped the colon correctly with an
explicit comment. Apply the same .replace(':', '') in the two remaining
sites that assigned protocol directly: getHttpSpanDetailsFromUrlObject
in packages/core and the Bun server integration.

Update the 18 test assertions that were written to match the wrong value.
@github-actions github-actions Bot added the external PR from an external contributor label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant