-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(ember)!: Use function and ui.task span ops for route hooks and runloop
#22669
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
Changes from all commits
71a5e20
019a544
9dcb64d
8960d79
d9b3e6c
2ca3aa3
63b4326
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import { subscribe } from '@ember/instrumentation'; | ||
| import { scheduleOnce } from '@ember/runloop'; | ||
| import type { EmberRunQueues } from '@ember/runloop/-private/types'; | ||
| import { SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes'; | ||
| import { BROWSER_UI_RENDER_SPAN_OP, BROWSER_UI_TASK_SPAN_OP, GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; | ||
| import { getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/browser'; | ||
| import type { Span } from '@sentry/core'; | ||
| import { browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/core'; | ||
|
|
@@ -89,10 +91,11 @@ function _instrumentEmberRunloop(config: { minimumRunloopQueueDuration?: number | |
| if ((now - currentQueueStart) * 1000 >= minQueueDuration) { | ||
| startInactiveSpan({ | ||
| attributes: { | ||
| [SENTRY_OP]: BROWSER_UI_TASK_SPAN_OP, | ||
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', | ||
| 'ember.runloop.queue': queue, | ||
| }, | ||
| name: 'runloop', | ||
| op: `ui.ember.runloop.${queue}`, | ||
| startTime: currentQueueStart, | ||
| onlyIfParent: true, | ||
| })?.end(now); | ||
|
|
@@ -147,13 +150,16 @@ function processComponentRenderAfter( | |
| const now = timestampInSeconds(); | ||
| const componentRenderDuration = now - begin.now; | ||
|
|
||
| const name = payload.containerKey || payload.object; | ||
|
|
||
| if (componentRenderDuration * 1000 >= minComponentDuration) { | ||
| startInactiveSpan({ | ||
| name: payload.containerKey || payload.object, | ||
| op, | ||
| name, | ||
| startTime: begin.now, | ||
| attributes: { | ||
| [SENTRY_OP]: op, | ||
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', | ||
| [UI_COMPONENT_NAME]: name, | ||
|
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. New attribute lacks test coverageLow Severity Newly added Additional Locations (1)Triggered by project rule: PR Review Guidelines for Cursor Bot Reviewed by Cursor Bugbot for commit 63b4326. Configure here. |
||
| }, | ||
| onlyIfParent: true, | ||
| })?.end(now); | ||
|
|
@@ -178,7 +184,7 @@ function _instrumentComponents(config: { | |
| }, | ||
|
|
||
| after(_name: string, _timestamp: number, payload: Payload, _beganIndex: number) { | ||
| processComponentRenderAfter(payload, beforeEntries, 'ui.ember.component.render', minComponentDuration); | ||
| processComponentRenderAfter(payload, beforeEntries, BROWSER_UI_RENDER_SPAN_OP, minComponentDuration); | ||
| }, | ||
| }); | ||
| if (enableComponentDefinitions) { | ||
|
|
@@ -188,7 +194,7 @@ function _instrumentComponents(config: { | |
| }, | ||
|
|
||
| after(_name: string, _timestamp: number, payload: Payload, _beganIndex: number) { | ||
| processComponentRenderAfter(payload, beforeComponentDefinitionEntries, 'ui.ember.component.definition', 0); | ||
| processComponentRenderAfter(payload, beforeComponentDefinitionEntries, GENERAL_FUNCTION_SPAN_OP, 0); | ||
| }, | ||
| }); | ||
| } | ||
|
|
@@ -230,9 +236,10 @@ function _instrumentInitialLoad(): void { | |
| const endTime = startTime + measure.duration / 1000; | ||
|
|
||
| startInactiveSpan({ | ||
| op: 'ui.ember.init', | ||
| name: 'init', | ||
| attributes: { | ||
| // TODO(v11): Replace with the `ui.mount` constant from `@sentry/conventions/op` once it is registered there. | ||
| [SENTRY_OP]: 'ui.mount', | ||
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', | ||
| }, | ||
| startTime, | ||
|
|
||


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.
m: does
ember.runloop.queuealso need to be added to@sentry/conventions?Uh oh!
There was an error while loading. Please reload this page.
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.
I'm not sure whether we want to add library-specific attributes to conventions (I don't think so). If yes we'll probably wanna add it to #18895.
cc @Lms24
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.
yes, all attributes sent from our SDKs should be in conventions
we should always use a more generic attribute if possible that isn't tied to a specific lib or framework. I'm not sure if there's a specific replacement for
ember.runloop.queue. If there's none, we can add an ember-specific attribute. There's precedence for framework-specific attributes, for example, Remix.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.
i'm not really familiar with ember but from a quick search i couldn't find any fitting generic attribute and from this guide it looks like the run queue is a pretty specific/unique concept, so yes we should probably add this ember-specific attribute to conventions then.