Skip to content

Commit fcf9bac

Browse files
authored
feat(core): Remove startTransaction export (#11015)
Instead we, for now, inline this directly into core `trace` functions, which is the only place left where we use this.
1 parent 5ccc813 commit fcf9bac

File tree

29 files changed

+86
-397
lines changed

29 files changed

+86
-397
lines changed

dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/subject.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ async function run() {
33
Sentry.startSpan({ name: 'child_span' }, () => {
44
// whatever a user would do here
55
});
6+
7+
// unfinished spans are filtered out
8+
Sentry.startInactiveSpan({ name: 'span_4' });
69
});
710
}
811

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const transaction = Sentry.startTransaction({ name: 'some_transaction' });
1+
const transaction = Sentry.startInactiveSpan({
2+
name: 'some_transaction',
3+
forceTransaction: true,
4+
});
25

36
transaction.setMeasurement('metric.foo', 42, 'ms');
47
transaction.setMeasurement('metric.bar', 1337, 'nanoseconds');

dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/subject.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/test.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

dev-packages/browser-integration-tests/suites/public-api/startTransaction/init.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ export {
4343
makeMain,
4444
setCurrentClient,
4545
Scope,
46-
// eslint-disable-next-line deprecation/deprecation
47-
startTransaction,
4846
continueTrace,
4947
SDK_VERSION,
5048
setContext,

packages/core/src/exports.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type {
22
CaptureContext,
33
CheckIn,
4-
CustomSamplingContext,
54
Event,
65
EventHint,
76
EventProcessor,
@@ -13,7 +12,6 @@ import type {
1312
Session,
1413
SessionContext,
1514
SeverityLevel,
16-
TransactionContext,
1715
User,
1816
} from '@sentry/types';
1917
import { GLOBAL_OBJ, isThenable, logger, timestampInSeconds, uuid4 } from '@sentry/utils';
@@ -22,7 +20,6 @@ import { DEFAULT_ENVIRONMENT } from './constants';
2220
import { getClient, getCurrentScope, getIsolationScope } from './currentScopes';
2321
import { DEBUG_BUILD } from './debug-build';
2422
import type { Hub } from './hub';
25-
import { getCurrentHub } from './hub';
2623
import { closeSession, makeSession, updateSession } from './session';
2724
import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
2825
import { parseEventHintOrCaptureContext } from './utils/prepareEvent';
@@ -124,36 +121,6 @@ export function setUser(user: User | null): ReturnType<Hub['setUser']> {
124121
getIsolationScope().setUser(user);
125122
}
126123

127-
/**
128-
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
129-
*
130-
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
131-
* new child span within the transaction or any span, call the respective `.startChild()` method.
132-
*
133-
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
134-
*
135-
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
136-
* finished child spans will be sent to Sentry.
137-
*
138-
* NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call
139-
* `startTransaction` directly on the hub.
140-
*
141-
* @param context Properties of the new `Transaction`.
142-
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
143-
* default values). See {@link Options.tracesSampler}.
144-
*
145-
* @returns The transaction which was just started
146-
*
147-
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
148-
*/
149-
export function startTransaction(
150-
context: TransactionContext,
151-
customSamplingContext?: CustomSamplingContext,
152-
): ReturnType<Hub['startTransaction']> {
153-
// eslint-disable-next-line deprecation/deprecation
154-
return getCurrentHub().startTransaction({ ...context }, customSamplingContext);
155-
}
156-
157124
/**
158125
* Create a cron monitor check in and send it to Sentry.
159126
*

0 commit comments

Comments
 (0)