From 85d002215b6b8eeee2436aa2c85108d05801af36 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 18 Nov 2024 13:48:09 +0100 Subject: [PATCH] Re-added `Sentry.continueTrace` to pass down tracing context - we need this so we can pass tracing context throug the isolated scope --- src/app.ts | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/app.ts b/src/app.ts index fd8b174f..7d5d4fb2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -400,19 +400,27 @@ app.use(async (ctx, next) => { return event; }); - return Sentry.startSpan( + return Sentry.continueTrace( { - op: 'http.server', - name: `${ctx.req.method} ${ctx.req.path}`, - attributes: { - ...extra, - 'service.name': 'activitypub', - }, + sentryTrace: ctx.req.header('sentry-trace'), + baggage: ctx.req.header('baggage'), }, () => { - return withContext(extra, () => { - return next(); - }); + return Sentry.startSpan( + { + op: 'http.server', + name: `${ctx.req.method} ${ctx.req.path}`, + attributes: { + ...extra, + 'service.name': 'activitypub', + }, + }, + () => { + return withContext(extra, () => { + return next(); + }); + }, + ); }, ); });