Skip to content

feat(v8): Remove deprecated traceHeaders method #10776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 0 additions & 8 deletions packages/core/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,6 @@ Sentry.init({...});
return result;
}

/**
* @inheritDoc
* @deprecated Use `spanToTraceHeader()` instead.
*/
public traceHeaders(): { [key: string]: string } {
return this._callExtensionMethod<{ [key: string]: string }>('traceHeaders');
}

/**
* @inheritDoc
*
Expand Down
18 changes: 0 additions & 18 deletions packages/core/src/tracing/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@ import { logger } from '@sentry/utils';
import { getMainCarrier } from '../asyncContext';

import { DEBUG_BUILD } from '../debug-build';
import { spanToTraceHeader } from '../utils/spanUtils';
import { registerErrorInstrumentation } from './errors';
import { IdleTransaction } from './idletransaction';
import { sampleTransaction } from './sampling';
import { Transaction } from './transaction';

/** Returns all trace headers that are currently on the top scope. */
function traceHeaders(this: Hub): { [key: string]: string } {
// eslint-disable-next-line deprecation/deprecation
const scope = this.getScope();
// eslint-disable-next-line deprecation/deprecation
const span = scope.getSpan();

return span
? {
'sentry-trace': spanToTraceHeader(span),
}
: {};
}

/**
* Creates a new transaction and adds a sampling decision if it doesn't yet have one.
*
Expand Down Expand Up @@ -142,9 +127,6 @@ export function addTracingExtensions(): void {
if (!carrier.__SENTRY__.extensions.startTransaction) {
carrier.__SENTRY__.extensions.startTransaction = _startTransaction;
}
if (!carrier.__SENTRY__.extensions.traceHeaders) {
carrier.__SENTRY__.extensions.traceHeaders = traceHeaders;
}

registerErrorInstrumentation();
}
5 changes: 0 additions & 5 deletions packages/node-experimental/src/sdk/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
withScope,
} from '@sentry/core';
import { getClient } from './api';
import { callExtensionMethod } from './globals';

/**
* This is for legacy reasons, and returns a proxy object instead of a hub to be used.
Expand Down Expand Up @@ -77,10 +76,6 @@ export function getCurrentHub(): Hub {
return getClient().getIntegration(integration);
},

traceHeaders(): { [key: string]: string } {
return callExtensionMethod<{ [key: string]: string }>(this, 'traceHeaders');
},

startTransaction(
_context: TransactionContext,
_customSamplingContext?: CustomSamplingContext,
Expand Down
5 changes: 0 additions & 5 deletions packages/opentelemetry/src/custom/getCurrentHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ export function getCurrentHub(): Hub {
return getClient()?.getIntegration(integration) || null;
},

traceHeaders(): { [key: string]: string } {
// TODO: Do we need this??
return {};
},

startTransaction(
_context: TransactionContext,
_customSamplingContext?: CustomSamplingContext,
Expand Down
7 changes: 0 additions & 7 deletions packages/types/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,6 @@ export interface Hub {
*/
getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;

/**
* Returns all trace headers that are currently on the top scope.
*
* @deprecated Use `spanToTraceHeader()` instead.
*/
traceHeaders(): { [key: string]: string };

/**
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
*
Expand Down