diff --git a/dev-packages/browser-integration-tests/package.json b/dev-packages/browser-integration-tests/package.json index 50ef6c483135..ca00e7f20d53 100644 --- a/dev-packages/browser-integration-tests/package.json +++ b/dev-packages/browser-integration-tests/package.json @@ -63,6 +63,7 @@ "@sentry/browser": "10.63.0", "@sentry/replay": "10.63.0", "@sentry/opentelemetry": "10.63.0", + "@sentry/conventions": "0.15.1", "@supabase/supabase-js": "2.49.3", "axios": "1.16.0", "babel-loader": "^10.1.1", diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts index 0b6af5fb420d..624f565a9369 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts @@ -16,6 +16,7 @@ import { import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { waitForStreamedSpanEnvelope } from '../../../../utils/spanUtils'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; sentryTest( 'sends a streamed span envelope if spanStreamingIntegration is enabled', @@ -100,6 +101,10 @@ sentryTest( type: 'string', value: 'production', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }, end_timestamp: expect.any(Number), is_segment: false, @@ -136,6 +141,10 @@ sentryTest( type: 'string', value: 'production', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }, end_timestamp: expect.any(Number), is_segment: false, @@ -176,6 +185,10 @@ sentryTest( type: 'string', value: 'Connection Refused', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }, end_timestamp: expect.any(Number), is_segment: false, @@ -252,6 +265,10 @@ sentryTest( type: 'string', value: 'production', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }, end_timestamp: expect.any(Number), is_segment: true, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts index 8d4269d2c88b..bcd9e0a7a9ba 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts @@ -12,6 +12,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpan, waitForStreamedSpans } from '../../../../utils/spanUtils'; @@ -42,6 +43,10 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser expect(interactionSegmentSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, 'culture.calendar': { type: 'string', value: expect.any(String), @@ -122,6 +127,10 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser const interactionSpan = interactionSpanTree.find(span => getSpanOp(span) === 'ui.interaction.click'); expect(interactionSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.interaction.click', diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts index af6f8bedb75e..6f08a47cb624 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts @@ -8,6 +8,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { @@ -71,6 +72,10 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ brow expect(navigationSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, 'culture.calendar': { type: 'string', value: expect.any(String), diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts index 027c3e62aca5..16791d22a212 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts @@ -12,6 +12,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { getSpanOp, getSpansFromEnvelope, waitForStreamedSpanEnvelope } from '../../../../utils/spanUtils'; @@ -164,6 +165,10 @@ sentryTest( type: 'string', value: 'production', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }, end_timestamp: expect.any(Number), is_segment: true, diff --git a/dev-packages/cloudflare-integration-tests/package.json b/dev-packages/cloudflare-integration-tests/package.json index f7f2045059d9..ca5d894fcb04 100644 --- a/dev-packages/cloudflare-integration-tests/package.json +++ b/dev-packages/cloudflare-integration-tests/package.json @@ -21,6 +21,7 @@ "devDependencies": { "@cloudflare/workers-types": "^4.20260426.0", "@sentry-internal/test-utils": "10.63.0", + "@sentry/conventions": "0.15.1", "eslint-plugin-regexp": "^3.1.0", "vitest": "^3.2.6", "wrangler": "4.86.0" diff --git a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts index c51a400e7857..9d1280f64034 100644 --- a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts @@ -13,6 +13,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; @@ -77,6 +78,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(childSpan).toBeDefined(); expect(childSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test-child', @@ -103,6 +105,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(inactiveSpan).toBeDefined(); expect(inactiveSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, @@ -138,6 +141,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(manualSpan).toBeDefined(); expect(manualSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, @@ -158,6 +162,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(parentTestSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, @@ -179,6 +184,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(segmentSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS]: { diff --git a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts index 7ed898351fc2..f6d3029db39a 100644 --- a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts +++ b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts @@ -3,6 +3,10 @@ import { waitForStreamedSpans, getSpanOp } from '@sentry-internal/test-utils'; const SEGMENT_SPAN = { attributes: { + ['sentry.trace_lifecycle']: { + type: 'string', + value: 'stream', + }, 'app.start_time': { type: 'string', value: expect.any(String), @@ -170,6 +174,10 @@ test('Sends streamed spans (http.server and manual with Sentry.startSpan)', asyn expect(spans).toEqual([ { attributes: { + ['sentry.trace_lifecycle']: { + type: 'string', + value: 'stream', + }, 'sentry.environment': { type: 'string', value: 'qa', @@ -238,6 +246,10 @@ test('OTel span appears as child of Sentry span (interop)', async ({ baseURL }) expect(sentrySpan).toEqual({ attributes: { + ['sentry.trace_lifecycle']: { + type: 'string', + value: 'stream', + }, 'sentry.environment': { type: 'string', value: 'qa', @@ -275,6 +287,10 @@ test('OTel span appears as child of Sentry span (interop)', async ({ baseURL }) expect(otelSpan).toEqual({ attributes: { + ['sentry.trace_lifecycle']: { + type: 'string', + value: 'stream', + }, 'sentry.environment': { type: 'string', value: 'qa', diff --git a/dev-packages/node-core-integration-tests/package.json b/dev-packages/node-core-integration-tests/package.json index 339c81f55ea1..5e70a70a4659 100644 --- a/dev-packages/node-core-integration-tests/package.json +++ b/dev-packages/node-core-integration-tests/package.json @@ -50,6 +50,7 @@ "yargs": "^16.2.0" }, "devDependencies": { + "@sentry/conventions": "0.15.1", "@types/node-cron": "^3.0.11", "@types/node-schedule": "^2.1.7", "eslint-plugin-regexp": "^3.1.0", diff --git a/dev-packages/node-core-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts b/dev-packages/node-core-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts index 34b02875830b..567fea6f81d4 100644 --- a/dev-packages/node-core-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts +++ b/dev-packages/node-core-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts @@ -11,6 +11,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { expect, test } from 'vitest'; import { createRunner } from '../../../../utils/runner'; @@ -53,6 +54,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(childSpan).toBeDefined(); expect(childSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test-child', @@ -80,6 +82,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(inactiveSpan).toBeDefined(); expect(inactiveSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node-core' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -116,6 +119,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(manualSpan).toBeDefined(); expect(manualSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node-core' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -136,6 +140,7 @@ test('sends a streamed span envelope with correct spans for a manually started s }); const expectedAttributes: Record = { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node-core' }, diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index aebda7d552a1..fd02496f41e3 100644 --- a/dev-packages/node-integration-tests/package.json +++ b/dev-packages/node-integration-tests/package.json @@ -98,6 +98,7 @@ "yargs": "^16.2.0" }, "devDependencies": { + "@sentry/conventions": "0.15.1", "@sentry-internal/test-utils": "10.63.0", "@types/amqplib": "^0.10.5", "@types/node-cron": "^3.0.11", diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts index cc52933a1106..6481bb9439ec 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts @@ -11,6 +11,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { expect, test } from 'vitest'; import { createRunner } from '../../../../utils/runner'; @@ -53,6 +54,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(childSpan).toBeDefined(); expect(childSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test-child', @@ -80,6 +82,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(inactiveSpan).toBeDefined(); expect(inactiveSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -116,6 +119,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(manualSpan).toBeDefined(); expect(manualSpan).toEqual({ attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node' }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -136,6 +140,7 @@ test('sends a streamed span envelope with correct spans for a manually started s }); const expectedAttributes: Record = { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node' }, diff --git a/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts b/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts index 4a4bb592f24d..b23ac827a4d7 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts @@ -4,6 +4,7 @@ import { cleanupChildProcesses, createCjsTests, createEsmAndCjsTests } from '../ import { startMysqlTestServer } from './mysql-test-server'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; describe('mysql auto instrumentation', () => { // A minimal in-process MySQL server (on a random free port) so the client's @@ -255,6 +256,10 @@ describe('mysql auto instrumentation', () => { type: 'string', value: 'task', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }; const COMMON_SPAN_PROPS = { diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts index 572c08674137..2d54a069d6aa 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts @@ -1,5 +1,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -69,6 +70,10 @@ const COMMON_DB_ATTRIBUTES = { type: 'string', value: 'task', }, + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, }; /** diff --git a/packages/browser/test/integrations/spanstreaming.test.ts b/packages/browser/test/integrations/spanstreaming.test.ts index b480d0240701..dd5268dab4ec 100644 --- a/packages/browser/test/integrations/spanstreaming.test.ts +++ b/packages/browser/test/integrations/spanstreaming.test.ts @@ -4,6 +4,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, } from '@sentry/core/browser'; +import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { BrowserClient, spanStreamingIntegration } from '../../src'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; @@ -137,6 +138,10 @@ describe('spanStreamingIntegration', () => { start_timestamp: expect.any(Number), status: 'ok', attributes: { + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, 'sentry.origin': { type: 'string', value: 'manual', diff --git a/packages/core/src/tracing/spans/captureSpan.ts b/packages/core/src/tracing/spans/captureSpan.ts index a2fc6595e348..748c90f5c615 100644 --- a/packages/core/src/tracing/spans/captureSpan.ts +++ b/packages/core/src/tracing/spans/captureSpan.ts @@ -27,7 +27,7 @@ import { getCapturedScopesOnSpan } from '../utils'; import { isStreamedBeforeSendSpanCallback } from './beforeSendSpan'; import { scopeContextsToSpanAttributes } from './scopeContextAttributes'; import { DEFAULT_ENVIRONMENT } from '../../constants'; -import { SENTRY_SPAN_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SPAN_SOURCE, SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; export type SerializedStreamedSpanWithSegmentSpan = SerializedStreamedSpan & { _segmentSpan: Span; @@ -138,6 +138,7 @@ function applyCommonSpanAttributes( // avoid overwriting any previously set attributes (from users or potentially our SDK instrumentation) safeSetSpanJSONAttributes(spanJSON, { + [SENTRY_TRACE_LIFECYCLE]: 'stream', [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: release, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: environment || DEFAULT_ENVIRONMENT, [SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME]: serializedSegmentSpan.name, diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index aa81d664ea8c..e2b81fbd85df 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -25,7 +25,7 @@ import { import { safeSetSpanJSONAttributes } from '../../../../src/tracing/spans/captureSpan'; import { scopeContextsToSpanAttributes } from '../../../../src/tracing/spans/scopeContextAttributes'; import { getDefaultTestClientOptions, TestClient } from '../../../mocks/client'; -import { SENTRY_SPAN_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SPAN_SOURCE, SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; describe('captureSpan', () => { it.each([true, false, undefined])( @@ -67,6 +67,10 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { + [SENTRY_TRACE_LIFECYCLE]: { + type: 'string', + value: 'stream', + }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.client', @@ -204,6 +208,10 @@ describe('captureSpan', () => { value: 'staging', type: 'string', }, + [SENTRY_TRACE_LIFECYCLE]: { + value: 'stream', + type: 'string', + }, [SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME]: { value: 'sentry.javascript.node', type: 'string', @@ -300,6 +308,10 @@ describe('captureSpan', () => { value: 'production', type: 'string', }, + [SENTRY_TRACE_LIFECYCLE]: { + value: 'stream', + type: 'string', + }, }, _segmentSpan: span, }); @@ -344,6 +356,7 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { + [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.client' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, diff --git a/yarn.lock b/yarn.lock index 65b0cc12f4cb..66af6bbfe6a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7482,7 +7482,7 @@ "@sentry/cli-win32-i686" "2.58.6" "@sentry/cli-win32-x64" "2.58.6" -"@sentry/conventions@^0.15.1": +"@sentry/conventions@0.15.1", "@sentry/conventions@^0.15.1": version "0.15.1" resolved "https://registry.yarnpkg.com/@sentry/conventions/-/conventions-0.15.1.tgz#5b8888862d1e444678938f5afdd7842bca42f7cc" integrity sha512-ZLP8bRdMON3prWE2tJyImuYscCxdcJeIPIhrOs/rgyFm3C1nCh1B6gdvPj3AZ5zW08oSFFCsq7T+tYEW3h8MNA==