Skip to content

Commit

Permalink
ref(js): Simplify manual queue instrumentation code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Sep 20, 2024
1 parent cf47272 commit e4840c4
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ app.post("/publish", async (req, res) => {
"messaging.message.body.size": messageBodySize,
},
},
async (span) => {
const traceHeader = Sentry.spanToTraceHeader(span);
const baggageHeader = Sentry.spanToBaggageHeader(span);
async () => {
const { "sentry-trace": sentryTrace, baggage: sentryBaggage } =
getTraceData();
await redisClient.lPush(
"messages",
JSON.stringify({
traceHeader,
baggageHeader,
sentryTrace,
sentryBaggage,
timestamp: Date.now(),
messageId,
})
Expand Down Expand Up @@ -99,7 +99,7 @@ const message = JSON.parse(await redisClient.lPop(QUEUE_KEY));
const latency = Date.now() - message.timestamp;

Sentry.continueTrace(
{ sentryTrace: message.traceHeader, baggage: message.baggageHeader },
{ sentryTrace: message.sentryTrace, baggage: message.sentryBaggage },
() => {
Sentry.startSpan({
name: 'queue_consumer_transaction',
Expand Down

0 comments on commit e4840c4

Please sign in to comment.