-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(js): Document element timing option in browser tracing #16337
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,13 +18,14 @@ Capturing spans requires that you first <PlatformLink to="/tracing/">set up trac | |
|
|
||
| Once you enable tracing, the SDK automatically captures performance data without additional code: | ||
|
|
||
| | What | Description | Metrics | | ||
| |------|-------------|---------| | ||
| | **Page loads** | Full page load performance | LCP, CLS, TTFB | | ||
| | **Navigations** | Client-side route changes | Duration, Web Vitals | | ||
| | **HTTP requests** | All fetch/XHR calls | Duration, status, URL | | ||
| | **User interactions** | Clicks, inputs that trigger work | INP (responsiveness) | | ||
| | **Long tasks** | Main thread blocking > 50ms | Duration, attribution | | ||
| | What | Description | Metrics | | ||
| | --------------------- | ---------------------------------------------- | ------------------------------------------ | | ||
| | **Page loads** | Full page load performance | LCP, CLS, TTFB | | ||
| | **Navigations** | Client-side route changes | Duration, Web Vitals | | ||
| | **HTTP requests** | All fetch/XHR calls | Duration, status, URL | | ||
| | **User interactions** | Clicks, inputs that trigger work | INP (responsiveness) | | ||
| | **Long tasks** | Main thread blocking > 50ms | Duration, attribution | | ||
| | **Element timing** | Elements marked with `elementtiming` attribute | Render/load times for critical UI elements | | ||
|
|
||
| <PlatformContent includePath="performance/what-instrumentation-provides" /> | ||
|
|
||
|
|
@@ -188,6 +189,25 @@ Enable/disable spans for long animation frames. Falls back to long tasks if brow | |
|
|
||
| </SdkOption> | ||
|
|
||
| <SdkOption name="enableElementTiming" type='boolean' defaultValue='true' availableSince="9.35.0"> | ||
|
|
||
| Enable/disable automatic spans for [Element Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceElementTiming) entries. When enabled, Sentry captures performance data for elements marked with the `elementtiming` attribute. | ||
|
|
||
| This is useful for tracking when critical UI elements (like hero images or important text) are rendered on the page: | ||
|
Comment on lines
+194
to
+196
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here, maybe "supported elements" or something like that to signal that it doesn't work for all elements as readers can be optimistic and try slapping the attribute on a bunch of elements. |
||
|
|
||
| ```html | ||
| <img src="hero.jpg" elementtiming="hero-image" /> | ||
| <h1 elementtiming="main-heading">Welcome</h1> | ||
| ``` | ||
|
|
||
| Element timing spans will appear in your trace with names like `element[hero-image]` and include metrics such as: | ||
|
|
||
| - Render time | ||
| - Load time (for images) | ||
| - Element size and type | ||
|
|
||
| </SdkOption> | ||
|
|
||
| <SdkOption name="markBackgroundSpan" type='boolean' defaultValue='true'> | ||
|
|
||
| Mark pageload/navigation spans as "cancelled" when the tab moves to background. Recommended to keep enabled for accurate measurements. | ||
|
|
@@ -236,7 +256,7 @@ Ignore specific resource span categories by their `op` (e.g., `resource.script`, | |
| Sentry.init({ | ||
| integrations: [ | ||
| Sentry.browserTracingIntegration({ | ||
| ignoreResourceSpans: ['resource.css', 'resource.script'], | ||
| ignoreResourceSpans: ["resource.css", "resource.script"], | ||
| }), | ||
| ], | ||
| }); | ||
|
|
@@ -252,7 +272,7 @@ Ignore spans created from `performance.mark()` and `performance.measure()`: | |
| Sentry.init({ | ||
| integrations: [ | ||
| Sentry.browserTracingIntegration({ | ||
| ignorePerformanceApiSpans: ['myMeasurement', /myMark/], | ||
| ignorePerformanceApiSpans: ["myMeasurement", /myMark/], | ||
| }), | ||
| ], | ||
| }); | ||
|
|
@@ -285,7 +305,11 @@ Sentry.init({ | |
| }), | ||
| ], | ||
| tracesSampleRate: 1.0, | ||
| tracePropagationTargets: ["localhost", /^\//, /^https:\/\/yourserver\.io\/api/], | ||
| tracePropagationTargets: [ | ||
| "localhost", | ||
| /^\//, | ||
| /^https:\/\/yourserver\.io\/api/, | ||
| ], | ||
| }); | ||
| ``` | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: probably should mention that only specific elements are reported here.