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 @@ -32,14 +32,5 @@
"@types/express": "^4.17.17",
"@types/node": "^18.19.1",
"typescript": "~5.0.0"
},
"sentryTest": {
"variants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "nestjs-basic (tracer provider)"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ Sentry.init({
// We expect the app to send a lot of events in a short time
bufferSize: 1000,
},
// Opt into the Sentry OpenTelemetry tracer provider in the "(tracer provider)" e2e variant.
// Leaving it `undefined` otherwise keeps the SDK's default (no provider).
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,5 @@
"@playwright/test": "1.64.1",
"@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz",
"@sentry/core": "file:../../packed/sentry-core-packed.tgz"
},
"sentryTest": {
"variants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "node-express (tracer provider)"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ Sentry.init({
outputs: false,
},
},
// Opt into the Sentry OpenTelemetry tracer provider in the "(tracer provider)" e2e variant.
// Leaving it `undefined` otherwise keeps the SDK's default (no provider).
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
integrations: [
Sentry.nativeNodeFetchIntegration({
headersToSpanAttributes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.26.0",
"@opentelemetry/api": "^1.9.1",
"@sentry/node": "file:../../packed/sentry-node-packed.tgz",
"@trpc/server": "10.45.4",
"@trpc/client": "10.45.4",
Expand All @@ -24,6 +25,7 @@
"devDependencies": {
"@playwright/test": "1.64.1",
"@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz",
"@sentry/conventions": "0.33.0",
"@sentry/core": "file:../../packed/sentry-core-packed.tgz"
},
"sentryTest": {
Expand Down
11 changes: 11 additions & 0 deletions dev-packages/e2e-tests/test-applications/node-express/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Sentry.init({
],
});

import { trace } from '@opentelemetry/api';
import { TRPCError, initTRPC } from '@trpc/server';
import * as trpcExpress from '@trpc/server/adapters/express';
import express from 'express';
Expand Down Expand Up @@ -77,6 +78,16 @@ app.get('/test-transaction', function (_req, res) {
res.send({ status: 'ok' });
});

app.get('/test-otel-api-span', function (_req, res) {
const tracer = trace.getTracer('node-express');
tracer.startActiveSpan('otel-api-span', span => {
tracer.startActiveSpan('otel-api-child-span', childSpan => childSpan.end());
span.end();
});

res.send({ status: 'ok' });
});

app.get('/test-outgoing-fetch', async function (_req, res) {
const response = await fetch('http://localhost:3030/test-success');
const data = await response.json();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { expect, test } from '@playwright/test';
import { collectStreamedSpansUntilSegment, getSpanOp } from '@sentry-internal/test-utils';
import { HTTP_SERVER } from '@sentry/conventions/op';

test.skip(process.env.E2E_TEST_OTEL_SETUP !== 'true', 'Only runs in the tracer provider variant');

test('Captures spans started via @opentelemetry/api as children of the request span', async ({ baseURL }) => {
const spansPromise = collectStreamedSpansUntilSegment(
'node-express',
segment => getSpanOp(segment) === HTTP_SERVER && segment.name === 'GET /test-otel-api-span',
);

await fetch(`${baseURL}/test-otel-api-span`);

const spans = await spansPromise;
const segmentSpan = spans.find(span => span.is_segment && span.name === 'GET /test-otel-api-span')!;
const otelSpan = spans.find(span => span.name === 'otel-api-span');
const otelChildSpan = spans.find(span => span.name === 'otel-api-child-span');

expect(otelSpan).toEqual(
expect.objectContaining({
trace_id: segmentSpan.trace_id,
is_segment: false,
attributes: expect.objectContaining({
'sentry.segment.id': { value: segmentSpan.span_id, type: 'string' },
}),
}),
);
expect(otelChildSpan).toEqual(
expect.objectContaining({
trace_id: segmentSpan.trace_id,
parent_span_id: otelSpan!.span_id,
is_segment: false,
}),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,5 @@
"devDependencies": {
"@playwright/test": "1.64.1",
"@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz"
},
"sentryTest": {
"variants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "node-fastify-5 (tracer provider)"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ Sentry.init({
tracesSampleRate: 1,
tunnel: 'http://localhost:3031/', // proxy server
tracePropagationTargets: ['http://localhost:3030', '/external-allowed'],
// Opt into the Sentry OpenTelemetry tracer provider in the "(tracer provider)" e2e variant.
// Leaving it `undefined` otherwise keeps the SDK's default (no provider).
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
});

import type * as H from 'http';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
"@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz"
},
"sentryTest": {
"optional": true,
"optionalVariants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "node-fastify-6 (tracer provider)"
}
]
"optional": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Sentry.init({
tracesSampleRate: 1,
tunnel: 'http://localhost:3031/', // proxy server
tracePropagationTargets: ['http://localhost:3030', '/external-allowed'],
// Only the "(tracer provider)" variant opts in; `undefined` keeps the SDK default
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
});

import type * as H from 'http';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
"@sentry-internal/test-utils": "file:../../packed/sentry-internal-test-utils-packed.tgz"
},
"sentryTest": {
"variants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "nuxt-4-static (tracer provider)"
}
],
"canaryVariants": [
{
"build-command": "pnpm test:build-canary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
tracesSampleRate: 1.0, // Capture 100% of the transactions
tunnel: 'http://localhost:3031/', // proxy server
// Opt into the Sentry OpenTelemetry tracer provider in the "(tracer provider)" e2e variant.
// Leaving it `undefined` otherwise keeps the SDK's default (no provider).
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
// Several tests trigger the same server error one after another, which Dedupe would drop.
integrations: integrations => integrations.filter(integration => integration.name !== 'Dedupe'),
});
5 changes: 0 additions & 5 deletions dev-packages/e2e-tests/test-applications/nuxt-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
},
"sentryTest": {
"variants": [
{
"build-command": "E2E_TEST_OTEL_SETUP=true pnpm test:build",
"assert-command": "E2E_TEST_OTEL_SETUP=true pnpm test:assert",
"label": "nuxt-4 (tracer provider)"
},
{
"build-command": "pnpm test:build",
"assert-command": "pnpm test:prod:import",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ Sentry.init({
dsn: process.env.E2E_TEST_TUNNEL ? 'http://public@localhost:3031/1337' : 'https://public@dsn.ingest.sentry.io/1337',
tracesSampleRate: 1.0, // Capture 100% of the transactions
tunnel: 'http://localhost:3031/', // proxy server
// Opt into the Sentry OpenTelemetry tracer provider in the "(tracer provider)" e2e variant.
// Leaving it `undefined` otherwise keeps the SDK's default (no provider).
enableOpenTelemetrySetup: process.env.E2E_TEST_OTEL_SETUP === 'true' ? true : undefined,
// Several tests trigger the same server error one after another, which Dedupe would drop.
integrations: integrations => [
...integrations.filter(integration => integration.name !== 'Dedupe'),
Expand Down
Loading