@sentry/ember 7.105.0 → 8.0.0-alpha.2
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/README.md +1 -1
- package/addon/index.ts +15 -16
- package/addon/instance-initializers/sentry-performance.ts +16 -23
- package/addon/types.ts +2 -4
- package/index.d.ts +0 -7
- package/package.json +6 -6
- package/types.d.ts +2 -2
package/README.md
CHANGED
package/addon/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, applySdkMetadata } from '@sentry/core
|
|
|
9
9
|
import { GLOBAL_OBJ } from '@sentry/utils';
|
|
10
10
|
import Ember from 'ember';
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { TransactionSource } from '@sentry/types';
|
|
13
13
|
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
|
|
14
14
|
|
|
15
15
|
function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
|
|
@@ -60,33 +60,24 @@ export function init(_runtimeConfig?: BrowserOptions): void {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Grabs active transaction off scope.
|
|
65
|
-
*
|
|
66
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
67
|
-
*/
|
|
68
|
-
export const getActiveTransaction = (): Transaction | undefined => {
|
|
69
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
70
|
-
return Sentry.getCurrentScope().getTransaction();
|
|
71
|
-
};
|
|
72
|
-
|
|
73
63
|
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
74
64
|
|
|
75
65
|
export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute: T): T => {
|
|
76
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
67
|
const instrumentFunction = async <X extends (...args: unknown[]) => any>(
|
|
78
68
|
op: string,
|
|
79
|
-
|
|
69
|
+
name: string,
|
|
80
70
|
fn: X,
|
|
81
71
|
args: Parameters<X>,
|
|
72
|
+
source: TransactionSource,
|
|
82
73
|
): Promise<ReturnType<X>> => {
|
|
83
74
|
return startSpan(
|
|
84
75
|
{
|
|
85
76
|
attributes: {
|
|
86
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
77
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
87
78
|
},
|
|
88
79
|
op,
|
|
89
|
-
name
|
|
80
|
+
name,
|
|
90
81
|
},
|
|
91
82
|
() => {
|
|
92
83
|
return fn(...args);
|
|
@@ -105,15 +96,22 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
|
|
|
105
96
|
this.fullRouteName,
|
|
106
97
|
super.beforeModel.bind(this),
|
|
107
98
|
args,
|
|
99
|
+
'custom',
|
|
108
100
|
);
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
public async model(...args: unknown[]): Promise<unknown> {
|
|
112
|
-
return instrumentFunction('ui.ember.route.model', this.fullRouteName, super.model.bind(this), args);
|
|
104
|
+
return instrumentFunction('ui.ember.route.model', this.fullRouteName, super.model.bind(this), args, 'custom');
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
public afterModel(...args: unknown[]): void | Promise<unknown> {
|
|
116
|
-
return instrumentFunction(
|
|
108
|
+
return instrumentFunction(
|
|
109
|
+
'ui.ember.route.after_model',
|
|
110
|
+
this.fullRouteName,
|
|
111
|
+
super.afterModel.bind(this),
|
|
112
|
+
args,
|
|
113
|
+
'custom',
|
|
114
|
+
);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
public setupController(...args: unknown[]): void | Promise<unknown> {
|
|
@@ -122,6 +120,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
|
|
|
122
120
|
this.fullRouteName,
|
|
123
121
|
super.setupController.bind(this),
|
|
124
122
|
args,
|
|
123
|
+
'custom',
|
|
125
124
|
);
|
|
126
125
|
}
|
|
127
126
|
},
|
|
@@ -6,14 +6,20 @@ import type RouterService from '@ember/routing/router-service';
|
|
|
6
6
|
import { _backburner, run, scheduleOnce } from '@ember/runloop';
|
|
7
7
|
import type { EmberRunQueues } from '@ember/runloop/-private/types';
|
|
8
8
|
import { getOwnConfig, isTesting, macroCondition } from '@embroider/macros';
|
|
9
|
-
import * as Sentry from '@sentry/browser';
|
|
10
9
|
import type { ExtendedBackburner } from '@sentry/ember/runloop';
|
|
11
10
|
import type { Span } from '@sentry/types';
|
|
12
11
|
import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils';
|
|
13
12
|
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
13
|
+
import type { BrowserClient } from '@sentry/browser';
|
|
14
|
+
import {
|
|
15
|
+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
|
16
|
+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
|
|
17
|
+
getActiveSpan,
|
|
18
|
+
getClient,
|
|
19
|
+
startBrowserTracingNavigationSpan,
|
|
20
|
+
startBrowserTracingPageLoadSpan,
|
|
21
|
+
startInactiveSpan,
|
|
22
|
+
} from '@sentry/browser';
|
|
17
23
|
import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
|
|
18
24
|
|
|
19
25
|
function getSentryConfig(): EmberSentryConfig {
|
|
@@ -103,28 +109,21 @@ export function _instrumentEmberRouter(
|
|
|
103
109
|
const browserTracingOptions = config.browserTracingOptions || config.sentry.browserTracingOptions || {};
|
|
104
110
|
const url = getLocationURL(location);
|
|
105
111
|
|
|
106
|
-
const client =
|
|
112
|
+
const client = getClient<BrowserClient>();
|
|
107
113
|
|
|
108
114
|
if (!client) {
|
|
109
115
|
return;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
if (
|
|
113
|
-
url &&
|
|
114
|
-
browserTracingOptions.startTransactionOnPageLoad !== false &&
|
|
115
|
-
browserTracingOptions.instrumentPageLoad !== false
|
|
116
|
-
) {
|
|
118
|
+
if (url && browserTracingOptions.instrumentPageLoad !== false) {
|
|
117
119
|
const routeInfo = routerService.recognize(url);
|
|
118
|
-
activeRootSpan =
|
|
120
|
+
activeRootSpan = startBrowserTracingPageLoadSpan(client, {
|
|
119
121
|
name: `route:${routeInfo.name}`,
|
|
120
122
|
origin: 'auto.pageload.ember',
|
|
121
123
|
attributes: {
|
|
122
124
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
123
|
-
},
|
|
124
|
-
tags: {
|
|
125
125
|
url,
|
|
126
126
|
toRoute: routeInfo.name,
|
|
127
|
-
'routing.instrumentation': '@sentry/ember',
|
|
128
127
|
},
|
|
129
128
|
});
|
|
130
129
|
}
|
|
@@ -137,10 +136,7 @@ export function _instrumentEmberRouter(
|
|
|
137
136
|
getBackburner().off('end', finishActiveTransaction);
|
|
138
137
|
};
|
|
139
138
|
|
|
140
|
-
if (
|
|
141
|
-
browserTracingOptions.startTransactionOnLocationChange === false &&
|
|
142
|
-
browserTracingOptions.instrumentNavigation === false
|
|
143
|
-
) {
|
|
139
|
+
if (browserTracingOptions.instrumentNavigation === false) {
|
|
144
140
|
return;
|
|
145
141
|
}
|
|
146
142
|
|
|
@@ -148,16 +144,13 @@ export function _instrumentEmberRouter(
|
|
|
148
144
|
const { fromRoute, toRoute } = getTransitionInformation(transition, routerService);
|
|
149
145
|
activeRootSpan?.end();
|
|
150
146
|
|
|
151
|
-
activeRootSpan =
|
|
147
|
+
activeRootSpan = startBrowserTracingNavigationSpan(client, {
|
|
152
148
|
name: `route:${toRoute}`,
|
|
153
149
|
origin: 'auto.navigation.ember',
|
|
154
150
|
attributes: {
|
|
155
151
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
156
|
-
},
|
|
157
|
-
tags: {
|
|
158
152
|
fromRoute,
|
|
159
153
|
toRoute,
|
|
160
|
-
'routing.instrumentation': '@sentry/ember',
|
|
161
154
|
},
|
|
162
155
|
});
|
|
163
156
|
|
|
@@ -429,7 +422,7 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
|
|
|
429
422
|
instrumentPageLoad: false,
|
|
430
423
|
});
|
|
431
424
|
|
|
432
|
-
const client =
|
|
425
|
+
const client = getClient<BrowserClient>();
|
|
433
426
|
|
|
434
427
|
const isAlreadyInitialized = macroCondition(isTesting()) ? !!client?.getIntegrationByName('BrowserTracing') : false;
|
|
435
428
|
|
package/addon/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { BrowserOptions,
|
|
1
|
+
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
2
|
import type { Transaction, TransactionContext } from '@sentry/types';
|
|
3
3
|
|
|
4
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0]
|
|
5
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
6
|
-
ConstructorParameters<typeof BrowserTracing>[0];
|
|
4
|
+
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
7
5
|
|
|
8
6
|
export type EmberSentryConfig = {
|
|
9
7
|
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };
|
package/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import type Route from '@ember/routing/route';
|
|
2
2
|
import type { BrowserOptions } from '@sentry/browser';
|
|
3
|
-
import type { Transaction } from '@sentry/types';
|
|
4
3
|
/**
|
|
5
4
|
* Initialize the Sentry SDK for Ember.
|
|
6
5
|
*/
|
|
7
6
|
export declare function init(_runtimeConfig?: BrowserOptions): void;
|
|
8
|
-
/**
|
|
9
|
-
* Grabs active transaction off scope.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
12
|
-
*/
|
|
13
|
-
export declare const getActiveTransaction: () => Transaction | undefined;
|
|
14
7
|
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
15
8
|
export declare const instrumentRoutePerformance: <T extends RouteConstructor>(BaseRoute: T) => T;
|
|
16
9
|
export * from '@sentry/browser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/ember",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.2",
|
|
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": "
|
|
36
|
-
"@sentry/core": "
|
|
37
|
-
"@sentry/types": "
|
|
38
|
-
"@sentry/utils": "
|
|
35
|
+
"@sentry/browser": "8.0.0-alpha.2",
|
|
36
|
+
"@sentry/core": "8.0.0-alpha.2",
|
|
37
|
+
"@sentry/types": "8.0.0-alpha.2",
|
|
38
|
+
"@sentry/utils": "8.0.0-alpha.2",
|
|
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",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"webpack": "~5.74.0"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
|
-
"node": "14
|
|
86
|
+
"node": ">=14.8"
|
|
87
87
|
},
|
|
88
88
|
"ember": {
|
|
89
89
|
"edition": "octane"
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BrowserOptions,
|
|
1
|
+
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
2
|
import type { Transaction, TransactionContext } from '@sentry/types';
|
|
3
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0]
|
|
3
|
+
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
4
4
|
export type EmberSentryConfig = {
|
|
5
5
|
sentry: BrowserOptions & {
|
|
6
6
|
browserTracingOptions?: BrowserTracingOptions;
|