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
@@ -1,4 +1,4 @@
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import {
SENTRY_SEGMENT_NAME_SOURCE,
SENTRY_SDK_NAME,
Expand All @@ -10,6 +10,7 @@ import {
SENTRY_RELEASE,
SENTRY_SDK_INTEGRATIONS,
SENTRY_OP,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import { expect, it } from 'vitest';
import { createRunner } from '../../../runner';
Expand Down Expand Up @@ -85,7 +86,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
},
name: 'test-child-span',
Expand All @@ -104,7 +105,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
attributes: {
'sentry.is_localhost': { value: true, type: 'boolean' },
[SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK },
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
Expand Down Expand Up @@ -141,7 +142,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
attributes: {
'sentry.is_localhost': { value: true, type: 'boolean' },
[SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK },
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
Expand Down Expand Up @@ -169,7 +170,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
},
name: 'test-span',
Expand All @@ -193,7 +194,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
value: expect.arrayContaining(['SpanStreaming']),
},
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' },
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
[SENTRY_OP]: { type: 'string', value: 'http.server' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, it } from 'vitest';
import type { Envelope, SerializedStreamedSpan } from '@sentry/core';
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
import { SDK_VERSION } from '@sentry/core';
import {
SENTRY_SDK_NAME,
SENTRY_SDK_VERSION,
Expand All @@ -9,6 +9,7 @@ import {
SENTRY_TRACE_LIFECYCLE,
SENTRY_ENVIRONMENT,
SENTRY_OP,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../runner';
import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils';
Expand Down Expand Up @@ -37,7 +38,7 @@ function commonAttributes(segmentSpan: SerializedStreamedSpan): SerializedStream
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentSpan.name },
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
[SENTRY_OP]: { type: 'string', value: 'db.query' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' },
'db.system.name': { type: 'string', value: 'cloudflare-d1' },
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SENTRY_OP } from '@sentry/conventions/attributes';
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import type { Envelope } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
import { expect, it } from 'vitest';
import { createRunner } from '../../../runner';
import { getSpansFromEnvelope } from '../../../spanUtils';
Expand All @@ -24,7 +23,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal
expect(segmentSpan?.attributes['url.path']).toEqual({ type: 'string', value: '/exec' });

const sqlSpans = spans.filter(
span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql',
span => span.attributes[SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql',
);

expect(sqlSpans).toHaveLength(3);
Expand All @@ -34,7 +33,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal
name: 'CREATE TABLE users',
attributes: expect.objectContaining({
[SENTRY_OP]: { type: 'string', value: 'db.query' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' },
'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' },
'db.operation.name': { type: 'string', value: 'exec' },
'db.query.text': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SENTRY_OP } from '@sentry/conventions/attributes';
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import type { Envelope } from '@sentry/core';
import { expect, it } from 'vitest';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
import { createRunner } from '../../../runner';
import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils';

Expand Down Expand Up @@ -31,7 +30,7 @@ it('instruments sync KV operations on Durable Object storage', async ({ signal }
name: 'durable_object_storage_kv_put',
attributes: expect.objectContaining({
[SENTRY_OP]: { type: 'string', value: 'db' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' },
'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' },
'db.operation.name': { type: 'string', value: 'put' },
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes';
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import { expect, it } from 'vitest';
import type { Event } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import { createRunner } from '../../../runner';
import { getSpansFromEnvelope } from '../../../spanUtils';

Expand All @@ -21,7 +21,7 @@ it('Scheduled handler creates a segment span with correct attributes', async ({
status: 'ok',
attributes: expect.objectContaining({
[SENTRY_OP]: { type: 'string', value: 'function' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' },
[SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' },
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 },
'code.function.name': { type: 'string', value: 'scheduled' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes';
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import { expect, it } from 'vitest';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
import { createRunner } from '../../../runner';

it('Workflow steps create segment spans with correct attributes', async ({ signal }) => {
Expand All @@ -25,7 +25,7 @@ it('Workflow steps create segment spans with correct attributes', async ({ signa
status: 'ok',
attributes: expect.objectContaining({
[SENTRY_OP]: { type: 'string', value: 'function' },
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' },
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' },
[SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' },
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 },
'code.function.name': { type: 'string', value: stepName },
Expand Down
Loading
Loading