sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Implicit OpenTelemetry initialization

Open jamescrosswell opened this issue 11 months ago • 0 comments

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.

  1. You need to Initialize OpenTelemetry... e.g.: https://github.com/getsentry/sentry-dotnet/blob/bd62cf0421cc7a5d7b7804f8461fae00d47d43b8/samples/Sentry.Samples.OpenTelemetry.Console/Program.cs#L23-L30
  2. 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.

jamescrosswell avatar Mar 18 '24 05:03 jamescrosswell