Skip to content

feat:instrument browser document url full#237

Draft
mquentin wants to merge 4 commits intoopen-telemetry:mainfrom
mquentin:feat_Instrument_browser-document-url-full
Draft

feat:instrument browser document url full#237
mquentin wants to merge 4 commits intoopen-telemetry:mainfrom
mquentin:feat_Instrument_browser-document-url-full

Conversation

@mquentin
Copy link
Copy Markdown
Contributor

@mquentin mquentin commented Apr 22, 2026

Which problem is this PR solving?

Stacked on top
of #225 and open-telemetry/semantic-conventions#3633 providing a solution to this issue: #174 (comment)

Fixes # #174 (comment)

Short description of the changes

Adds BrowserDocumentUrlInstrumentation that stamps every OTel span and every OTel log record event with browser.document.url.full derived from location.href at creation time.

Also add this new instrumentation to the sandbox testing environment

Screenshot 2026-04-22 at 11 55 21 Screenshot 2026-04-22 at 11 46 50

Note - comment about alternative approaches:

We just add a log/span processor classes that add this attribute to all logs/spans. There is already a precedent for session.id here.
We work towards making this a resource attribute.

The second option is ultimately what we want (for both this and session). However, the mechanism for this is not defined yet. My hope is to prototype this in the end-to-end demo that we have discussed. And I would like to prototype it in a way that it can support multiple different attributes, using entities, and show how updates would be handled by the SDK. I described this in the discussion topic.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this an approach we do for other instrumentations? I'm wondering if instead of trying to patch the existing logger provider we should instead just have a log processors package that users can use when they init the SDK. I don't like that we're depending on an internal API (_activeSpanProcessor) to add the processor

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So this is really a draft of a draft. I am actually up to any suggestion because I started this more as a demo than a PR proposal.

@mquentin mquentin force-pushed the feat_Instrument_browser-document-url-full branch from 44c4f55 to d011b42 Compare May 4, 2026 14:25
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