Title: Enrich attributes of Spans created from PerformanceMeasure events · Issue #16237 · getsentry/sentry-javascript · GitHub
Open Graph Title: Enrich attributes of Spans created from PerformanceMeasure events · Issue #16237 · getsentry/sentry-javascript
X Title: Enrich attributes of Spans created from PerformanceMeasure events · Issue #16237 · getsentry/sentry-javascript
Description: Problem Statement Sentry automatically creates Spans from PerformanceEvents, which is great 👍 But manually created measure events contain the analog of Span.attributes named PerformanceMeasure.detail, which are not propagated to traces. ...
Open Graph Description: Problem Statement Sentry automatically creates Spans from PerformanceEvents, which is great 👍 But manually created measure events contain the analog of Span.attributes named PerformanceMeasure.deta...
X Description: Problem Statement Sentry automatically creates Spans from PerformanceEvents, which is great 👍 But manually created measure events contain the analog of Span.attributes named PerformanceMeasure.deta...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/16237
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enrich attributes of Spans created from PerformanceMeasure events","articleBody":"### Problem Statement\n\nSentry [automatically creates Spans from PerformanceEvents](https://github.com/getsentry/sentry-javascript/blob/develop/packages/browser-utils/src/metrics/browserMetrics.ts#L306), which is great 👍 \n\nBut manually created measure events contain the analog of `Span.attributes` named [PerformanceMeasure.detail](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMeasure/detail), which [are not propagated](https://github.com/getsentry/sentry-javascript/blob/develop/packages/browser-utils/src/metrics/browserMetrics.ts#L422) to traces.\n\nHere's how the native measure event looks in dev-tools:\n\n\n\nAnd here's the `Span` created from it, lacking vital data:\n\n\n\n# My request is\n\n## ...to enrich `Span.attributes` with the `detail` data 🙏 \n\nThank you for consideration! 😊 \n\n### Solution Brainstorm\n\nThe caveat is, of course, that the `PerformanceMeasure.detail` is not type-restricted and can be anything whatsoever:\n\n```typescript\ninterface PerformanceMeasureOptions {\n detail?: any;\n duration?: DOMHighResTimeStamp;\n end?: string | DOMHighResTimeStamp;\n start?: string | DOMHighResTimeStamp;\n}\n```\n\nNaturally, I would expect Sentry to support the same data types as in `Span.attributes` itself. Anything extra can be gracefully dropped, or serialized _somehow_, if configured explicitly:\n\n```typescript\nexport function _convertToSpanAttributes(data: unknown): SpanAttributes {\n // type checks, attribute traversals, array maps, etc...\n}\n\nexport function _extractAttributesFromEntry(entry: PerformanceEntry): SpanAttributes {\n if(isPerformanceMeasure(entry)) {\n return _convertToSpanAttributes(entry.detail);\n }\n // Here we can support more entry types\n return {};\n}\n\nexport function _addMeasureSpans(...\n ...\n\n // The PerformanceMeasure may contain arbitrary metadata in \"detail\" attribute.\n // We try to add as much as possible from \"detail\" to attributes\n const attributesFromEntry = _extractAttributesFromEntry(entry);\n\n const attributes: SpanAttributes = {\n ...attributesFromEntry,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics',\n };\n```\n\n### Product Area\n\nUnknown","author":{"url":"https://github.com/allista","@type":"Person","name":"allista"},"datePublished":"2025-05-08T15:41:37Z","url":"https://github.com/getsentry/sentry-javascript/issues/16237"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c1250753-1e74-0dea-79d6-1dc87e8cc1c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A85E:1A6ABD:956CD:CB85D:6B0736C6 |
| html-safe-nonce | 6fe450a1e3a93efce2d6bcd56981c24ac793fe13f7d03e5dd752656f572b40d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODVFOjFBNkFCRDo5NTZDRDpDQjg1RDo2QjA3MzZDNiIsInZpc2l0b3JfaWQiOiIzODU0OTU2Nzg0NjA3NzcwMzExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4f6ab81b3f9761ff0740462c823994cf9c09d397a6dbd9547c77841bf462c800 |
| hovercard-subject-tag | issue:3049419906 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/16237/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9644c829a7ffc5e8034cf252cb52d1a0eae9a97883f01857fd42460bdbfc181/getsentry/sentry-javascript/issues/16237 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9644c829a7ffc5e8034cf252cb52d1a0eae9a97883f01857fd42460bdbfc181/getsentry/sentry-javascript/issues/16237 |
| og:image:alt | Problem Statement Sentry automatically creates Spans from PerformanceEvents, which is great 👍 But manually created measure events contain the analog of Span.attributes named PerformanceMeasure.deta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | allista |
| hostname | github.com |
| expected-hostname | github.com |
| None | d97a1befc96fc1512839eca15eb541061d491301144c9168e2985a8580319a49 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d28643426bfe8d1692f8788961b8217e9003f493 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width