@sentry/ember 7.91.0 → 7.93.0
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 +17 -16
- package/addon/instance-initializers/sentry-performance.ts +19 -25
- package/index.d.ts +5 -0
- package/package.json +5 -4
package/addon/index.ts
CHANGED
|
@@ -2,13 +2,14 @@ import { assert, warn } from '@ember/debug';
|
|
|
2
2
|
import type Route from '@ember/routing/route';
|
|
3
3
|
import { next } from '@ember/runloop';
|
|
4
4
|
import { getOwnConfig, isDevelopingApp, macroCondition } from '@embroider/macros';
|
|
5
|
+
import { startSpan } from '@sentry/browser';
|
|
5
6
|
import type { BrowserOptions } from '@sentry/browser';
|
|
6
7
|
import * as Sentry from '@sentry/browser';
|
|
7
8
|
import { SDK_VERSION } from '@sentry/browser';
|
|
8
|
-
import
|
|
9
|
-
import { GLOBAL_OBJ, timestampInSeconds } from '@sentry/utils';
|
|
9
|
+
import { GLOBAL_OBJ } from '@sentry/utils';
|
|
10
10
|
import Ember from 'ember';
|
|
11
11
|
|
|
12
|
+
import type { Transaction } from '@sentry/types';
|
|
12
13
|
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
|
|
13
14
|
|
|
14
15
|
function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
|
|
@@ -66,7 +67,13 @@ export function InitSentryForEmber(_runtimeConfig?: BrowserOptions): void {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Grabs active transaction off scope.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
74
|
+
*/
|
|
69
75
|
export const getActiveTransaction = (): Transaction | undefined => {
|
|
76
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
70
77
|
return Sentry.getCurrentHub().getScope().getTransaction();
|
|
71
78
|
};
|
|
72
79
|
|
|
@@ -80,22 +87,16 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
|
|
|
80
87
|
fn: X,
|
|
81
88
|
args: Parameters<X>,
|
|
82
89
|
): Promise<ReturnType<X>> => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const currentTransaction = getActiveTransaction();
|
|
87
|
-
if (!currentTransaction) {
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
currentTransaction
|
|
91
|
-
.startChild({
|
|
90
|
+
return startSpan(
|
|
91
|
+
{
|
|
92
92
|
op,
|
|
93
|
-
description,
|
|
93
|
+
name: description,
|
|
94
94
|
origin: 'auto.ui.ember',
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
},
|
|
96
|
+
() => {
|
|
97
|
+
return fn(...args);
|
|
98
|
+
},
|
|
99
|
+
);
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
const routeName = BaseRoute.name;
|
|
@@ -12,7 +12,7 @@ import type { Span, Transaction } from '@sentry/types';
|
|
|
12
12
|
import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils';
|
|
13
13
|
|
|
14
14
|
import type { BrowserClient } from '..';
|
|
15
|
-
import {
|
|
15
|
+
import { getActiveSpan, startInactiveSpan } from '..';
|
|
16
16
|
import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig, StartTransactionFunction } from '../types';
|
|
17
17
|
|
|
18
18
|
type SentryTestRouterService = RouterService & {
|
|
@@ -149,9 +149,9 @@ export function _instrumentEmberRouter(
|
|
|
149
149
|
'routing.instrumentation': '@sentry/ember',
|
|
150
150
|
},
|
|
151
151
|
});
|
|
152
|
-
transitionSpan =
|
|
152
|
+
transitionSpan = startInactiveSpan({
|
|
153
153
|
op: 'ui.ember.transition',
|
|
154
|
-
|
|
154
|
+
name: `route:${fromRoute} -> route:${toRoute}`,
|
|
155
155
|
origin: 'auto.ui.ember',
|
|
156
156
|
});
|
|
157
157
|
});
|
|
@@ -195,8 +195,8 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
|
|
|
195
195
|
if (previousInstance) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
if (!
|
|
198
|
+
const activeSpan = getActiveSpan();
|
|
199
|
+
if (!activeSpan) {
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
if (currentQueueSpan) {
|
|
@@ -211,22 +211,20 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
|
|
|
211
211
|
const minQueueDuration = minimumRunloopQueueDuration ?? 5;
|
|
212
212
|
|
|
213
213
|
if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
})
|
|
221
|
-
.end();
|
|
214
|
+
startInactiveSpan({
|
|
215
|
+
name: 'runloop',
|
|
216
|
+
op: `ui.ember.runloop.${queue}`,
|
|
217
|
+
origin: 'auto.ui.ember',
|
|
218
|
+
startTimestamp: currentQueueStart,
|
|
219
|
+
})?.end(now);
|
|
222
220
|
}
|
|
223
221
|
currentQueueStart = undefined;
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
// Setup for next queue
|
|
227
225
|
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
226
|
+
const stillActiveSpan = getActiveSpan();
|
|
227
|
+
if (!stillActiveSpan) {
|
|
230
228
|
return;
|
|
231
229
|
}
|
|
232
230
|
currentQueueStart = timestampInSeconds();
|
|
@@ -286,15 +284,12 @@ function processComponentRenderAfter(
|
|
|
286
284
|
const componentRenderDuration = now - begin.now;
|
|
287
285
|
|
|
288
286
|
if (componentRenderDuration * 1000 >= minComponentDuration) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
activeTransaction?.startChild({
|
|
287
|
+
startInactiveSpan({
|
|
288
|
+
name: payload.containerKey || payload.object,
|
|
292
289
|
op,
|
|
293
|
-
description: payload.containerKey || payload.object,
|
|
294
290
|
origin: 'auto.ui.ember',
|
|
295
291
|
startTimestamp: begin.now,
|
|
296
|
-
|
|
297
|
-
});
|
|
292
|
+
})?.end(now);
|
|
298
293
|
}
|
|
299
294
|
}
|
|
300
295
|
|
|
@@ -372,13 +367,12 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
|
|
|
372
367
|
const startTimestamp = (measure.startTime + browserPerformanceTimeOrigin) / 1000;
|
|
373
368
|
const endTimestamp = startTimestamp + measure.duration / 1000;
|
|
374
369
|
|
|
375
|
-
|
|
376
|
-
const span = transaction?.startChild({
|
|
370
|
+
startInactiveSpan({
|
|
377
371
|
op: 'ui.ember.init',
|
|
372
|
+
name: 'init',
|
|
378
373
|
origin: 'auto.ui.ember',
|
|
379
374
|
startTimestamp,
|
|
380
|
-
});
|
|
381
|
-
span?.end(endTimestamp);
|
|
375
|
+
})?.end(endTimestamp);
|
|
382
376
|
performance.clearMarks(startName);
|
|
383
377
|
performance.clearMarks(endName);
|
|
384
378
|
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import type Route from '@ember/routing/route';
|
|
|
2
2
|
import type { BrowserOptions } from '@sentry/browser';
|
|
3
3
|
import type { Transaction } from '@sentry/types';
|
|
4
4
|
export declare function InitSentryForEmber(_runtimeConfig?: BrowserOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* Grabs active transaction off scope.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
9
|
+
*/
|
|
5
10
|
export declare const getActiveTransaction: () => Transaction | undefined;
|
|
6
11
|
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
7
12
|
export declare const instrumentRoutePerformance: <T extends RouteConstructor>(BaseRoute: T) => T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/ember",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.93.0",
|
|
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,9 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@embroider/macros": "^1.9.0",
|
|
35
|
-
"@sentry/browser": "7.
|
|
36
|
-
"@sentry/
|
|
37
|
-
"@sentry/
|
|
35
|
+
"@sentry/browser": "7.93.0",
|
|
36
|
+
"@sentry/core": "7.93.0",
|
|
37
|
+
"@sentry/types": "7.93.0",
|
|
38
|
+
"@sentry/utils": "7.93.0",
|
|
38
39
|
"ember-auto-import": "^1.12.1 || ^2.4.3",
|
|
39
40
|
"ember-cli-babel": "^7.26.11",
|
|
40
41
|
"ember-cli-htmlbars": "^6.1.1",
|