Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(instrumentation-document-load): add custom root span to document page load instrumentation #1092

Closed
wants to merge 6 commits into from

Conversation

gregolsen
Copy link

Which problem is this PR solving?

Page load instrumentation creates and ends its own root span. However, for a typical single-page JS app, transaction is not completed after the initial page load is finished. Ideally, single-page app should be able to attach more spans to the root span and have control over when the root span is ended.

Short description of the changes

This PR extends instrumentation with an optional rootSpan config parameter. When rootSpan is passed instrumentation attaches all the child spans/attributes to that rootSpan and doesn't end the span.

Checklist

  • [N/A] Ran npm run test-all-versions for the edited package(s) on the latest commit if applicable.

@gregolsen gregolsen requested a review from a team July 18, 2022 11:44
@github-actions github-actions bot requested a review from obecny July 18, 2022 11:44
@gregolsen gregolsen changed the title Add custom root span to document page load instrumentation feat(opentelemetry-instrumentation-document-load): add custom root span to document page load instrumentation Jul 18, 2022
@gregolsen
Copy link
Author

@rauno56 rauno56 changed the title feat(opentelemetry-instrumentation-document-load): add custom root span to document page load instrumentation feat(instrumentation-document-load): add custom root span to document page load instrumentation Sep 14, 2022
@rauno56
Copy link
Member

rauno56 commented Sep 14, 2022

@gregolsen, updating changelogs is actually done automatically during the release.

Can someone knowledgeable in RUM look at this? @t2t2, @MSNev, @mhennoch

@gregolsen
Copy link
Author

Thank you @rauno56 - I got rid of the release update and rebased against the fresh main 🙇🏻

@mhennoch
Copy link
Contributor

Will take a look tomorrow

@rauno56
Copy link
Member

rauno56 commented Sep 27, 2022

@mhennoch, have you had a moment?

@mhennoch
Copy link
Contributor

Looked OK but wanted to test it but haven't had the time. Maybe also @t2t2 can take a look.

@rauno56
Copy link
Member

rauno56 commented Oct 12, 2022

@t2t2, will yoy have a moment to check it out?

@t2t2
Copy link
Contributor

t2t2 commented Oct 12, 2022

Depends on if you want an answer to this PR wise or a big picture answer

Like yes pr does what it says it does, if user wants to manually manage the document load span like this then yes this is the way

But big picture wise, if I wanted a good set of rum instrumentations, I'd probably come up with a way to have documentLoad span be active from start of instrumentations being loaded until page load event happens. This would probably also decouple html resources (img, link, script tags) from document load instrumentation somewhat allowing it to also work for SPA use, making both documentLoad and userInteraction work similarly:

image

As noted on image this sort of idea wouldn't work for those who would base interaction duration from root span duration (but rather would need post-processing once sure that no more data comes from the trace). For those, quoting PR "Ideally, single-page app should be able to attach more spans to the root span and have control over when the root span is ended.", would be better. So the more automatically possible behavior would probably be better as an alternative choice of instrumentation for those who can use it

@gregolsen
Copy link
Author

A bit more context about our setup that may help here:
In our tracing setup page load is followed by the Ember.js app loading. Only after the Ember.js view is loaded we complete the traces. User clicking on something is considered a separate interaction and would emit a separate trace.

@github-actions
Copy link
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Feb 27, 2023
@github-actions
Copy link
Contributor

This PR was closed because it has been stale for 14 days with no activity.

@github-actions github-actions bot closed this Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants