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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SENTRY_SDK_NAME,
SENTRY_SDK_VERSION,
SENTRY_TRACE_LIFECYCLE,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import { expect, test } from 'vitest';
import { createRunner } from '../../../../utils/runner';
Expand Down Expand Up @@ -65,6 +66,7 @@ test('sends a streamed span envelope with correct spans for a manually started s
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
Comment thread
cursor[bot] marked this conversation as resolved.
[SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' },
Expand All @@ -89,6 +91,7 @@ test('sends a streamed span envelope with correct spans for a manually started s
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' },
Expand Down Expand Up @@ -126,6 +129,7 @@ test('sends a streamed span envelope with correct spans for a manually started s
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' },
Expand All @@ -143,6 +147,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' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' },
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 },
[SENTRY_SDK_NAME]: { type: 'string', value: 'sentry.javascript.node-core' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
spanKindToName,
} from '@sentry/core';
import { inferSpanData } from './parseSpanDescription';
import { SENTRY_ORIGIN } from '@sentry/conventions/attributes';

/**
* Backfill op, source, name and data on a streamed span JSON from OTel semantic conventions.
Expand All @@ -30,6 +31,11 @@ export function backfillStreamedSpanDataFromOtel(spanJSON: StreamedSpanJSON, hin
safeSetSpanJSONAttributes(spanJSON, {
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
// If nothing in the chain previously set an origin, we now default it to 'manual'
// For transactions, this is done in the SpanExporter.
// TODO (v11): Remove this again once we fully moved away from OTel's TracerProvider.
// at this point, we use `SentrySpan` everywhere, which defaults its origin to 'manual'.
[SENTRY_ORIGIN]: 'manual',
...data,
});

Expand Down
Loading