Skip to content
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
2 changes: 2 additions & 0 deletions packages/bundler-plugins/src/core/build-plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ export function createSentryBuildPluginManager(
Only use this if you need to manually inject debug IDs into the build artifacts.
*/
async injectDebugIds(buildArtifactPaths: string[]) {
// oxlint-disable-next-line typescript/no-deprecated
await startSpan({ name: 'inject-debug-ids', scope: sentryScope, forceTransaction: true }, async () => {
try {
const cliInstance = new SentryCliAdapter(options);
Expand Down Expand Up @@ -561,6 +562,7 @@ export function createSentryBuildPluginManager(

await startSpan(
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
// oxlint-disable-next-line typescript/no-deprecated
{ name: 'debug-id-sourcemap-upload', scope: sentryScope, forceTransaction: true },
async () => {
// If we're not using a temp folder, we must not prepare artifacts in-place (to avoid mutating user files)
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/integrations/mcp-server/spans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function createMcpSpan(config: McpSpanConfig): unknown {
return startSpan(
{
name: spanName,
// oxlint-disable-next-line typescript/no-deprecated
Comment thread
Lms24 marked this conversation as resolved.
forceTransaction: true,
attributes,
},
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/tracing/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { SUPPRESS_TRACING_KEY } from './constants';
*/
export function startSpan<T>(options: StartSpanOptions, callback: (span: Span) => T): T {
const spanArguments = parseSentrySpanArguments(options);
// oxlint-disable-next-line typescript/no-deprecated
const { forceTransaction, parentSpan: customParentSpan, scope: customScope } = options;

// We still need to fork a potentially passed scope, as we set the active span on it
Expand Down Expand Up @@ -104,6 +105,7 @@ export function startSpan<T>(options: StartSpanOptions, callback: (span: Span) =
*/
export function startSpanManual<T>(options: StartSpanOptions, callback: (span: Span, finish: () => void) => T): T {
const spanArguments = parseSentrySpanArguments(options);
// oxlint-disable-next-line typescript/no-deprecated
const { forceTransaction, parentSpan: customParentSpan, scope: customScope } = options;

const customForkedScope = customScope?.clone();
Expand Down Expand Up @@ -150,6 +152,7 @@ export function startSpanManual<T>(options: StartSpanOptions, callback: (span: S
*/
export function startInactiveSpan(options: StartSpanOptions): Span {
const spanArguments = parseSentrySpanArguments(options);
// oxlint-disable-next-line typescript/no-deprecated
const { forceTransaction, parentSpan: customParentSpan, scope: customScope } = options;

// If `options.scope` is defined, we use this as as a wrapper,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) {
[TRPC_PROCEDURE_PATH]: String(path),
[TRPC_PROCEDURE_TYPE]: String(type),
},
// oxlint-disable-next-line typescript/no-deprecated
forceTransaction: !!options.forceTransaction,
},
async span => {
Expand Down
26 changes: 26 additions & 0 deletions packages/core/src/types/startSpanOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ export interface StartSpanOptions {
* If set to true, this span will be forced to be treated as a transaction in the Sentry UI, if possible and applicable.
* Note that it is up to the SDK to decide how exactly the span will be sent, which may change in future SDK versions.
* It is not guaranteed that a span started with this flag set to `true` will be sent as a transaction.
*
* @deprecated This option will be removed in the next major version of the SDK. There is no longer a concrete use
* case for it: all spans are indexed and searchable in Sentry, so a span no longer needs to be a transaction to be
* queried, filtered or aggregated on. In most cases, simply drop the option. The span is still sent, just as a child
* of its parent span, if a parent span is active.
* If you do need the span to be a segment (root) span, follow the examples below:.
*
* @example Making a span a root span:
* ```js
* Sentry.withActiveSpan(null, () => {
* Sentry.startSpan({ name: 'span-that-should-be-a-root' }, () => {
* // ...
* });
* });
* ```
*
* @example Keeping the root span attached to a specific trace:
* ```js
* Sentry.continueTrace({ sentryTrace, baggage }, () =>
* Sentry.withActiveSpan(null, () =>
* Sentry.startSpan({ name: 'span-that-should-be-a-root' }, () => {
* // ...
* }),
* ),
* );
* ```
*/
forceTransaction?: boolean;

Expand Down
1 change: 1 addition & 0 deletions packages/nestjs/src/integrations/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export function getEventSpanOptions(event: string): {
[SENTRY_OP]: FUNCTION,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.event.nestjs',
},
// oxlint-disable-next-line typescript/no-deprecated
forceTransaction: true,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ async function withServerActionInstrumentationImplementation<A extends (...args:
return await startSpan(
{
name: `serverAction/${serverActionName}`,
// oxlint-disable-next-line typescript/no-deprecated
forceTransaction: true,
attributes: {
[SENTRY_KIND]: 'server',
Expand Down
Loading