diff --git a/packages/apm/src/integrations/tracing.ts b/packages/apm/src/integrations/tracing.ts index 7b863d3bee5f..72a19de83d55 100644 --- a/packages/apm/src/integrations/tracing.ts +++ b/packages/apm/src/integrations/tracing.ts @@ -431,7 +431,7 @@ export class Tracing implements Integration { return undefined; } - Tracing._activeTransaction = hub.startSpan({ + Tracing._activeTransaction = hub.startTransaction({ trimEnd: true, ...transactionContext, }) as Transaction; diff --git a/packages/apm/test/hub.test.ts b/packages/apm/test/hub.test.ts index 9104beb3bbc2..6d9d464f5ace 100644 --- a/packages/apm/test/hub.test.ts +++ b/packages/apm/test/hub.test.ts @@ -1,6 +1,5 @@ import { BrowserClient } from '@sentry/browser'; import { Hub, Scope } from '@sentry/hub'; -import { Span, Transaction } from '@sentry/types'; import { addExtensionMethods } from '../src/hubextensions'; @@ -21,21 +20,18 @@ describe('Hub', () => { }); test('set tracesSampleRate 0 on transaction', () => { const hub = new Hub(new BrowserClient({ tracesSampleRate: 0 })); - // @ts-ignore - const transaction = hub.startSpan({ name: 'foo' }) as any; + const transaction = hub.startTransaction({ name: 'foo' }); expect(transaction.sampled).toBe(false); }); test('set tracesSampleRate 1 on transaction', () => { const hub = new Hub(new BrowserClient({ tracesSampleRate: 1 })); - // @ts-ignore - const transaction = hub.startSpan({ name: 'foo' }) as any; + const transaction = hub.startTransaction({ name: 'foo' }); expect(transaction.sampled).toBeTruthy(); }); test('set tracesSampleRate should be propergated to children', () => { const hub = new Hub(new BrowserClient({ tracesSampleRate: 0 })); - // @ts-ignore - const transaction = hub.startSpan({ name: 'foo' }) as any; - const child = transaction.startChild({ op: 1 }); + const transaction = hub.startTransaction({ name: 'foo' }); + const child = transaction.startChild({ op: 'test' }); expect(child.sampled).toBeFalsy(); }); }); @@ -49,8 +45,7 @@ describe('Hub', () => { test('simple standalone Transaction', () => { const hub = new Hub(new BrowserClient({ tracesSampleRate: 1 })); - // @ts-ignore - const transaction = hub.startSpan({ name: 'transaction' }) as Transaction; + const transaction = hub.startTransaction({ name: 'transaction' }); expect(transaction.spanId).toBeTruthy(); // tslint:disable-next-line: no-unbound-method expect(transaction.setName).toBeTruthy(); @@ -71,8 +66,7 @@ describe('Hub', () => { test('create a child if there is a Span already on the scope', () => { const myScope = new Scope(); const hub = new Hub(new BrowserClient({ tracesSampleRate: 1 }), myScope); - // @ts-ignore - const transaction = hub.startSpan({ name: 'transaction' }) as Transaction; + const transaction = hub.startTransaction({ name: 'transaction' }); hub.configureScope(scope => { scope.setSpan(transaction); }); diff --git a/packages/node/test/manual/apm-transaction/main.js b/packages/node/test/manual/apm-transaction/main.js index c9c165668940..97118a27bfc0 100644 --- a/packages/node/test/manual/apm-transaction/main.js +++ b/packages/node/test/manual/apm-transaction/main.js @@ -24,8 +24,8 @@ class Tracing { ? Span.fromTraceparent(req.headers['sentry-trace'], { transaction, }) - : Sentry.getCurrentHub().startSpan({ - transaction, + : Sentry.startTransaction({ + name: transaction, }); Sentry.getCurrentHub().configureScope(scope => {