@sentry/ember 8.0.0-beta.3 → 8.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon/index.ts CHANGED
@@ -5,7 +5,7 @@ import { getOwnConfig, isDevelopingApp, macroCondition } from '@embroider/macros
5
5
  import { startSpan } from '@sentry/browser';
6
6
  import type { BrowserOptions } from '@sentry/browser';
7
7
  import * as Sentry from '@sentry/browser';
8
- import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, applySdkMetadata } from '@sentry/core';
8
+ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, applySdkMetadata } from '@sentry/core';
9
9
  import { GLOBAL_OBJ } from '@sentry/utils';
10
10
  import Ember from 'ember';
11
11
 
@@ -75,9 +75,11 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
75
75
  {
76
76
  attributes: {
77
77
  [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
78
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
78
79
  },
79
80
  op,
80
81
  name,
82
+ onlyIfParent: true,
81
83
  },
82
84
  () => {
83
85
  return fn(...args);
@@ -145,6 +145,12 @@ export function _instrumentEmberRouter(
145
145
 
146
146
  routerService.on('routeWillChange', (transition: Transition) => {
147
147
  const { fromRoute, toRoute } = getTransitionInformation(transition, routerService);
148
+
149
+ // We want to ignore loading && error routes
150
+ if (transitionIsIntermediate(transition)) {
151
+ return;
152
+ }
153
+
148
154
  activeRootSpan?.end();
149
155
 
150
156
  activeRootSpan = startBrowserTracingNavigationSpan(client, {
@@ -163,11 +169,12 @@ export function _instrumentEmberRouter(
163
169
  },
164
170
  op: 'ui.ember.transition',
165
171
  name: `route:${fromRoute} -> route:${toRoute}`,
172
+ onlyIfParent: true,
166
173
  });
167
174
  });
168
175
 
169
- routerService.on('routeDidChange', () => {
170
- if (!transitionSpan || !activeRootSpan) {
176
+ routerService.on('routeDidChange', transition => {
177
+ if (!transitionSpan || !activeRootSpan || transitionIsIntermediate(transition)) {
171
178
  return;
172
179
  }
173
180
  transitionSpan.end();
@@ -224,6 +231,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
224
231
  name: 'runloop',
225
232
  op: `ui.ember.runloop.${queue}`,
226
233
  startTime: currentQueueStart,
234
+ onlyIfParent: true,
227
235
  })?.end(now);
228
236
  }
229
237
  currentQueueStart = undefined;
@@ -299,6 +307,7 @@ function processComponentRenderAfter(
299
307
  attributes: {
300
308
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
301
309
  },
310
+ onlyIfParent: true,
302
311
  })?.end(now);
303
312
  }
304
313
  }
@@ -384,6 +393,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
384
393
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
385
394
  },
386
395
  startTime,
396
+ onlyIfParent: true,
387
397
  })?.end(endTime);
388
398
  performance.clearMarks(startName);
389
399
  performance.clearMarks(endName);
@@ -488,3 +498,18 @@ function _instrumentNavigation(
488
498
  export default {
489
499
  initialize,
490
500
  };
501
+
502
+ function transitionIsIntermediate(transition: Transition): boolean {
503
+ // We want to use ignore, as this may actually be defined on new versions
504
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
505
+ // @ts-ignore This actually exists on newer versions
506
+ const isIntermediate: boolean | undefined = transition.isIntermediate;
507
+
508
+ if (typeof isIntermediate === 'boolean') {
509
+ return isIntermediate;
510
+ }
511
+
512
+ // For versions without this, we look if the route is a `.loading` or `.error` route
513
+ // This is not perfect and may false-positive in some cases, but it's the best we can do
514
+ return transition.to?.localName === 'loading' || transition.to?.localName === 'error';
515
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/ember",
3
- "version": "8.0.0-beta.3",
3
+ "version": "8.0.0-beta.5",
4
4
  "description": "Official Sentry SDK for Ember.js",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@embroider/macros": "^1.9.0",
35
- "@sentry/browser": "8.0.0-beta.3",
36
- "@sentry/core": "8.0.0-beta.3",
37
- "@sentry/types": "8.0.0-beta.3",
38
- "@sentry/utils": "8.0.0-beta.3",
35
+ "@sentry/browser": "8.0.0-beta.5",
36
+ "@sentry/core": "8.0.0-beta.5",
37
+ "@sentry/types": "8.0.0-beta.5",
38
+ "@sentry/utils": "8.0.0-beta.5",
39
39
  "ember-auto-import": "^1.12.1 || ^2.4.3",
40
40
  "ember-cli-babel": "^7.26.11",
41
41
  "ember-cli-htmlbars": "^6.1.1",