-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(node)!: Avoid http spans by default for custom OTEL setups #14678
Conversation
@@ -158,3 +158,4 @@ | |||
- Deprecated `addOpenTelemetryInstrumentation`. Use the `openTelemetryInstrumentations` option in `Sentry.init()` or your custom Sentry Client instead. | |||
- Deprecated `registerEsmLoaderHooks.include` and `registerEsmLoaderHooks.exclude`. Set `onlyIncludeInstrumentedModules: true` instead. | |||
- `registerEsmLoaderHooks` will only accept `true | false | undefined` in the future. The SDK will default to wrapping modules that are used as part of OpenTelemetry Instrumentation. | |||
- `httpIntegration({ spans: false })` is configured by default if `skipOpenTelemetrySetup: true` is set. You can still overwrite this if desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would phrase it a bit differently and explain it to people like this: "The httpIntegration will no longer set up the Opentelemetry HTTP Instrumentation when skipOpenTelemetrySetup: true, or when spans: false is set."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added "better" docs to the v8-to-v9 migration guide, which I only saw after I wrote this 😅 should we maintain both of these docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge them into one once develop becomes the "main" branch for the v9 work.
@@ -118,12 +121,21 @@ export const instrumentOtelHttp = generateInstrumentOnce<HttpInstrumentationConf | |||
return instrumentation; | |||
}); | |||
|
|||
/** Exported only for tests. */ | |||
export function _shouldInstrumentSpans(options: HttpOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Do we really need a helper function + test for this? Imo could just be a const with description. Makes it rather hard to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to double check the behavior is correct without adding integration tests etc for this 😅 I always find it easy for little bugs to sneak in in such places, e.g. if you have a wrong !
somewhere everything can become wrong, which can be easy to miss when testing "happy paths" in integration tests only.
size-limit report 📦
|
❌ 4 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
With this PR, the default value for the `spans` option in the `httpIntegration` is changed to `false`, if `skipOpenTelemetrySetup: true` is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario. Closes #14675
With this PR, the default value for the `spans` option in the `httpIntegration` is changed to `false`, if `skipOpenTelemetrySetup: true` is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario. Closes #14675
With this PR, the default value for the `spans` option in the `httpIntegration` is changed to `false`, if `skipOpenTelemetrySetup: true` is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario. Closes #14675
With this PR, the default value for the
spans
option in thehttpIntegration
is changed tofalse
, ifskipOpenTelemetrySetup: true
is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario.Closes #14675