feat: session and document URL as log resource entities#269
Conversation
… + document URL Adds a new packages/sdk-browser workspace with a multi-entity proxy LoggerProvider. setEntity(e) keys by entity.type and rebuilds an inner real LoggerProvider whose Resource is the base merged with all current entities; processor instances are reused across rebuilds. ProxyLogger resolves the current delegate on every emit so loggers obtained once during init transparently pick up new entities. Includes Entity factories for browser.session (session.id) and browser.document (browser.document.url.full, matching open-telemetry#237), plus a DocumentTracker that observes URL changes via popstate/hashchange and patched pushState/replaceState. Wires the example to use SessionManager from @opentelemetry/web-common and DocumentTracker, exposes Push History and Rotate Session buttons, and adds an OTLP HTTP processor pointed at the demo collector. Also adds http://localhost:5173 to the demo collector CORS origins.
Encapsulates EntityAwareLoggerProvider construction, the global logs.setGlobalLoggerProvider call, SessionManager start + observer wiring, and trackDocument(). Returns a BrowserSdk handle exposing the provider, document tracker, getSessionId(), rotateSession(), and shutdown(). Slims the example down to a single initializeSdk({...}) call.
|
Hey Martin, following @overbalance input about this change in yesterday SIG, I took the chance to think about it a bit. Problem statementWith this current PR entity implementation, I think carrying the Say:
Then you end up with a API intake request like: Chances are that not many logs will share the exact same For me
Suggestion1- We proceed with the span and log processor for What do you think about this ? |
|
Hey @mquentin I appreciate the thorough analysis. I don't remember if we discussed this but I don't think we should store query params in I still think is worth having entities that represent layers of the app that users can use as dimensions when searching for telemetry |
@joaquin-diaz indeed I don't think we discussed about it. I feel it would be misleading to change this semantic definition for the However, I also pretty fan of having
I think that's an interesting topic to discuss during the SIG |
Follow up on this, as we discussed about it during the SIG:
|
Demonstrates recording
browser.session(session.id) andbrowser.document(browser.document.url.full) as entities on the log resource, using a delegatingEntityAwareLoggerProvider.Related: discussion #265, #237.