Skip to content
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

Implicit OpenTelemetry initialization #3228

Closed
jamescrosswell opened this issue Mar 18, 2024 · 1 comment
Closed

Implicit OpenTelemetry initialization #3228

jamescrosswell opened this issue Mar 18, 2024 · 1 comment

Comments

@jamescrosswell
Copy link
Collaborator

jamescrosswell commented Mar 18, 2024

Related to:

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.:
    using var tracerProvider = Sdk.CreateTracerProviderBuilder()
    .AddSource(serviceName)
    .ConfigureResource(resource =>
    resource.AddService(
    serviceName: serviceName,
    serviceVersion: serviceVersion))
    .AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry
    .Build();
  2. You need to configure Sentry:
    SentrySdk.Init(options =>
    {
    // options.Dsn = "... Your DSN ...";
    options.TracesSampleRate = 1.0;
    options.UseOpenTelemetry(); // <-- Configure Sentry to use OpenTelemetry trace information
    });

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
Copy link
Collaborator Author

We didn't find any straight forward way to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant