feat: add side-effect-free startView API for manual page views - #96
Closed
parker-edwards wants to merge 9 commits into
Closed
feat: add side-effect-free startView API for manual page views#96parker-edwards wants to merge 9 commits into
parker-edwards wants to merge 9 commits into
Conversation
…ion coexistence cases
This was referenced Jul 22, 2026
thiemok
added a commit
that referenced
this pull request
Jul 24, 2026
…on (#99) What Adds XMLHttpRequest instrumentation (@dash0/xhr) — HTTP client spans and trace-context propagation for XHR, matching the existing fetch instrumentation. This replaces #93 (closed), split per feature at the reviewing team's request — this is part 2 of 3 and independent of the startView PR (#96); the interaction-instrumentation PR (#98) is stacked on top of this one. Why axios's default browser adapter uses XMLHttpRequest, so today axios/XHR-based applications get no HTTP spans and no traceparent header — their frontend telemetry never joins backend traces. How New @dash0/xhr instrumentation name, enabled by default alongside @dash0/fetch. First commit extracts the propagator/error helpers from fetch.ts into http/utils.ts, so fetch and XHR share one propagation code path (traceparent, X-Ray, propagators config, CORS URL allow-lists) — no behavior change for fetch. XHR spans cover the full lifecycle: success, error, timeout, and abort all end the span, and per-request event listeners are removed on completion to avoid leaks. Documented in INSTALL.md and the README feature list. axios is added as a devDependency only, for the e2e spec. --------- Co-authored-by: Parker Hyland <parker.hyland@dash0.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Thanks a lot for this contribution @parker-edwards! We've moved it to an in-repo branch as #101 so the e2e suite can run (fork PRs don't receive the LambdaTest secrets — same as #97 → #99). All of your commits are preserved there with authorship intact, with a few review follow-ups added on top (signature aligned with the sibling APIs as startView(name, opts?), malformed-input guarding for the script bridge, attribute-override semantics matching sendEvent, and extra test coverage). Closing this one in favor of #101. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a side-effect-free
startView(nameOrOptions)API for manually recording page views. This replaces #93 (closed), split per feature at the reviewing team's request — this is part 1 of 3, and it is fully independent of the other two (#97 XHR instrumentation, #98 interaction instrumentation).Why
I work with single-page applications that the automatic page-view instrumentation cannot fully cover — for example, an Electron-style SPA served from one root URL: every screen reports as
/, and the app owns its own router, so the SDK must not touchhistory/location.startViewgives these apps manual page views that are indistinguishable downstream from automatic virtual page views (samebrowser.page_viewevent, sametypevalue) without any navigation side effects.How
startViewaccepts a string shorthand (startView("Checkout")) or an options object (name, optionalurloverride). Exported from both the npm-package and script entrypoints.history.pushState/replaceStateand never mutateslocation. The emitted page view carries nochange_statevalue (no history mutation occurred) but is otherwise identical to an automatic virtual page view.instrumentations/navigation/event.tsso manual and automatic page views cannot drift.INSTALL.md.Testing
pnpm run ci(lint, prettier, unit tests, build): green — 272 unit tests across 19 files, including new coverage forstart-view.tsand the extracted log builder.08-start-view(string shorthand, options object,urloverride, no-side-effect assertions, coexistence with automatic instrumentation): green locally viapnpm run test:e2e:local.Notes for reviewers
This is my own initiative rather than a scheduled roadmap item — happy to adjust naming, semantics, or scope to fit your conventions.
🤖 Generated with Claude Code