-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Remove
sampled
flag from dynamic sampling context in Tra…
…cing without Performance mode (#13753) Fix a bug in Core that surfaced in Node apps configured for Tracing without Performance. Previously, we'd incorrectly add `sampled: false` flag when creating the DSC from an active span if the application was configured for TwP. This is possible because in TwP, Otel still emits non-recording spans for the incoming requests. Our implementation in Core didn't account for this edge case yet.
- Loading branch information
Showing
5 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,22 @@ const Sentry = require('@sentry/node'); | |
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
transport: loggingTransport, | ||
beforeSend(event) { | ||
event.contexts = { | ||
...event.contexts, | ||
traceData: { | ||
...Sentry.getTraceData(), | ||
metaTags: Sentry.getTraceMetaTags(), | ||
}, | ||
}; | ||
return event; | ||
}, | ||
}); | ||
|
||
// express must be required after Sentry is initialized | ||
const express = require('express'); | ||
|
||
const app = express(); | ||
|
||
app.get('/test', () => { | ||
throw new Error('test error'); | ||
app.get('/test', (_req, res) => { | ||
Sentry.withScope(scope => { | ||
scope.setContext('traceData', { | ||
...Sentry.getTraceData(), | ||
metaTags: Sentry.getTraceMetaTags(), | ||
}); | ||
Sentry.captureException(new Error('test error 2')); | ||
}); | ||
res.status(200).send(); | ||
}); | ||
|
||
Sentry.setupExpressErrorHandler(app); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters