Skip to content

Don't initialise the Sdk from logging integrations #5245

Description

@jamescrosswell

Description

This and this and this are just three examples in the last two weeks of many many conversations we've had about this issue over the years. It's very confusing to SDK users and even trips us up as maintainers on occasion.

Currently you can initialise Sentry:

  1. Via integrations like our Maui or Asp.Net Core integration that support a certain app type/framework
  2. Via the static SentrySdk.Init
  3. Via one of our logging integrations

The trouble is that the logging integrations are frequently used in conjunction with one of the first two types and then you have to tell the logging integration: Yes do send logs to Sentry, but no do not initialise the Sentry SDK (it's already been initialised).

Initialisation via the logging integrations was added so that if someone is only using the logging integration (e.g. in a Console app) they don't need to call SentrySdk.Init... it saves them a method call at startup.

Given the amount of confusion this causes, I think we should consider changing this so the logging integrations only configure the sink or whatever and the SDK always has to be initialised separately via 1 or 2.

Issues

Lot's of change so we're gonna drip feed it in multiple PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETPull requests that update .net codeBreaking ChangeBinary/Source/Behavioral Breaking Changes.LogsNext MajorChanges scheduled for the next Major release.Task

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions