Commit cc1cb7b
authored
feat(node): Ensure manual OTEL setup works (#12214)
Based on the great feedback in
#12191, this
does some small adjustments to ensure that you actually can use the Node
SDK properly with a custom OTEL setup:
## 1. Ensure we do not run `validateOpenTelemetrySetup()` when
`skipOpenTelemetrySetup` is configured.
Today, this is impossible to fix because you need a client to create the
sampler, and you need the sampler to satisfy the validation, but the
validation runs in `init()`. So either you call init() before doing your
manual setup, which means you get the warning, or you do the manual
setup first, but then you can't actually add the sampler, and still get
the warning.
This change means that users that configure `skipOpenTelemetrySetup` can
manually call `Sentry.validateOpenTelemetrySetup()` if they want to get
the validation, else there will be no validation automtically.
## 2. Export `SentryContextManager` from `@sentry/node`
This is easier to use than to use the primitive
`wrapContextManagerClass` from `@sentry/opentelemetry`.
## 3. Ensure we always run `setupEventContextTrace`, not tied to
`skipOpenTelemetrySetup`
There is no reason to tie this together, this now just always runs in
`init()` - it's just an event processor!1 parent 8fa393c commit cc1cb7b
4 files changed
Lines changed: 16 additions & 6 deletions
File tree
- dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts
- packages/node/src
- sdk
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
| 203 | + | |
199 | 204 | | |
200 | 205 | | |
201 | | - | |
| 206 | + | |
202 | 207 | | |
203 | 208 | | |
204 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
0 commit comments