Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify setting _hub on Transaction instance
  • Loading branch information
lobsterkatie committed Mar 1, 2021
commit 542d1d1aa9d27272c6c9832fbd9f5d165396634e
9 changes: 3 additions & 6 deletions packages/tracing/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TransactionContext,
TransactionMetadata,
} from '@sentry/types';
import { dropUndefinedKeys, isInstanceOf, logger } from '@sentry/utils';
import { dropUndefinedKeys, logger } from '@sentry/utils';

import { Span as SpanClass, SpanRecorder } from './span';

Expand All @@ -21,7 +21,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
/**
* The reference to the current hub.
*/
private readonly _hub: Hub = (getCurrentHub() as unknown) as Hub;
private readonly _hub: Hub;

private _trimEnd?: boolean;

Expand All @@ -35,13 +35,10 @@ export class Transaction extends SpanClass implements TransactionInterface {
public constructor(transactionContext: TransactionContext, hub?: Hub) {
super(transactionContext);

if (isInstanceOf(hub, Hub)) {
this._hub = hub as Hub;
}

this.name = transactionContext.name || '';
this.metadata = transactionContext.metadata || {};
this._trimEnd = transactionContext.trimEnd;
this._hub = hub || getCurrentHub();

// create a new sentry tracestate value if we didn't inherit one
if (!this.metadata.tracestate?.sentry) {
Expand Down