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
1 change: 1 addition & 0 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -100,6 +101,10 @@ sentryTest(
type: 'string',
value: 'production',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
},
end_timestamp: expect.any(Number),
is_segment: false,
Expand Down Expand Up @@ -136,6 +141,10 @@ sentryTest(
type: 'string',
value: 'production',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
},
end_timestamp: expect.any(Number),
is_segment: false,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -252,6 +265,10 @@ sentryTest(
type: 'string',
value: 'production',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
},
end_timestamp: expect.any(Number),
is_segment: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -164,6 +165,10 @@ sentryTest(
type: 'string',
value: 'production',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
},
end_timestamp: expect.any(Number),
is_segment: true,
Expand Down
1 change: 1 addition & 0 deletions dev-packages/cloudflare-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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',
Expand All @@ -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 },
Expand Down Expand Up @@ -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 },
Expand All @@ -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 },
Expand All @@ -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]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions dev-packages/node-core-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand All @@ -136,6 +140,7 @@ test('sends a streamed span envelope with correct spans for a manually started s
});

const expectedAttributes: Record<string, unknown> = {
[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' },
Expand Down
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { expect, test } from 'vitest';
import { createRunner } from '../../../../utils/runner';

Expand Down Expand Up @@ -54,6 +55,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',
Expand Down Expand Up @@ -82,6 +84,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 },
Expand Down Expand Up @@ -119,6 +122,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 },
Expand All @@ -140,6 +144,7 @@ test('sends a streamed span envelope with correct spans for a manually started s
});

const expectedAttributes: Record<string, unknown> = {
[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' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { startMysqlTestServer } from './mysql-test-server';
import type { SerializedStreamedSpanContainer } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
import { isOrchestrionEnabled } from '../../../utils';
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
Expand Down Expand Up @@ -266,6 +267,10 @@ describe('mysql auto instrumentation', () => {
type: 'string',
value: 'task',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
};

const COMMON_SPAN_PROPS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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, isOrchestrionEnabled } from '../../../utils';
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner';
Expand Down Expand Up @@ -75,6 +76,10 @@ const COMMON_DB_ATTRIBUTES = {
type: 'string',
value: 'task',
},
[SENTRY_TRACE_LIFECYCLE]: {
type: 'string',
value: 'stream',
},
};

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/browser/test/integrations/spanstreaming.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/tracing/spans/captureSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading