Skip to content

Commit 97e0827

Browse files
committed
add back getActiveTransaction
1 parent 8c8878d commit 97e0827

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/ember/addon/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { SDK_VERSION } from '@sentry/browser';
99
import { GLOBAL_OBJ } from '@sentry/utils';
1010
import Ember from 'ember';
1111

12+
import type { Transaction } from '@sentry/types';
1213
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
1314

1415
function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
@@ -68,6 +69,11 @@ export function InitSentryForEmber(_runtimeConfig?: BrowserOptions): void {
6869

6970
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
7071

72+
export const getActiveTransaction = (): Transaction | undefined => {
73+
// eslint-disable-next-line deprecation/deprecation
74+
return Sentry.getCurrentHub().getScope().getTransaction();
75+
};
76+
7177
export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute: T): T => {
7278
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7379
const instrumentFunction = async <X extends (...args: unknown[]) => any>(

0 commit comments

Comments
 (0)