Skip to content

fix(opentelemetry): Always use active span in Propagator.inject #13381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tmp debug logs
  • Loading branch information
Lms24 committed Sep 18, 2024
commit 68ca4e2c43fa77c7e3da8b95c12ff45ac1d2c69e
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
const Sentry = require('@sentry/node');
console.log('X-4');

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
transport: loggingTransport,
});
console.log('X-3');

// express must be required after Sentry is initialized
const express = require('express');
console.log('X-2');
const { startExpressServerAndSendPortToRunner } = require('@sentry-internal/node-integration-tests');
console.log('X-1');

const app = express();
console.log('X0');

app.get('/test', (_req, res) => {
console.log('X1');
Sentry.captureException(new Error('This is a test error'));
console.log('X2');
Sentry.getClient().on('beforeEnvelope', envelope => {
console.log('X3');
const event = envelope[1][0][1];
if (event.exception.values[0].value === 'This is a test error') {
console.log('X4');
const { trace_id, span_id } = event.contexts.trace;
res.send({
traceData: Sentry.getTraceData(),
Expand All @@ -31,5 +40,7 @@ app.get('/test', (_req, res) => {
});

Sentry.setupExpressErrorHandler(app);
console.log('X5');

startExpressServerAndSendPortToRunner(app);
console.log('X6');
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ describe('errors in Tracing without Performance mode', () => {

const response = await runner.makeRequest('get', '/test');

console.log('yy res', response);

const { traceData, traceMetaTags, errorTraceContext } = response as {
traceData: Record<string, string>;
traceMetaTags: string;
Expand Down Expand Up @@ -37,5 +39,7 @@ describe('errors in Tracing without Performance mode', () => {

expect(traceMetaTags).toContain(`content="${traceId}-${spanId}"/>\n`);
expect(traceMetaTags).toContain(`sentry-trace_id=${traceId}`);

console.log(runner.getLogs());
});
});
Loading