sentry-dotnet
sentry-dotnet copied to clipboard
Implicit OpenTelemetry initialization
Related to:
- https://github.com/getsentry/sentry-dotnet/issues/3159
Overview
If we're going to build upon OpenTelemetry and leverage this behind the scenes for Tracing, we don't want to add complexity for people who are currently using Sentry for Tracing. One important aspect of that is initialization.
At the moment if you want to use Sentry with OpenTelemetry for Tracing, initialization is a two step process.
- You need to Initialize OpenTelemetry... e.g.: https://github.com/getsentry/sentry-dotnet/blob/bd62cf0421cc7a5d7b7804f8461fae00d47d43b8/samples/Sentry.Samples.OpenTelemetry.Console/Program.cs#L23-L30
- You need to configure Sentry: https://github.com/getsentry/sentry-dotnet/blob/bd62cf0421cc7a5d7b7804f8461fae00d47d43b8/samples/Sentry.Samples.OpenTelemetry.Console/Program.cs#L16-L21
And the stuff you configure in step 1 has to match the stuff you configure in Step 2... You can't call UseOpenTelemetry
when initializing Sentry if you haven't called UseSentry
when initializing OpenTelemetry.
Ideally, particularly if users don't even know (or care) that OpenTelemetry is being used behind the scenes, this would be a seamless one step process.