Skip to content

Commit

Permalink
remove unnecessary definedness check
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Aug 12, 2024
1 parent 3688841 commit dda6ee6
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/opentelemetry/src/utils/getTraceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import { dropUndefinedKeys } from '@sentry/utils';
* @see `@sentry/core` version of `getTraceData` for more information
*/
export function getTraceData(): SerializedTraceData {
const context = api.context.active();

// This should never happen, given we always create an ambient non-recording span if there's no active span.
if (!context) {
return {};
}

const headersObject: Record<string, string> = {};

api.propagation.inject(context, headersObject);
api.propagation.inject(api.context.active(), headersObject);

if (!headersObject['sentry-trace']) {
return {};
Expand Down

0 comments on commit dda6ee6

Please sign in to comment.