getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
578 stars 206 forks source link

Support Spotlight without sending to Sentry #3481

Open jessetan opened 1 month ago

jessetan commented 1 month ago

Problem Statement

One of the first lines on the Spotlight about page is

One of the great benefits of this approach is you get the power of Sentry’s telemetry without needing to utilize Sentry’s production monitoring.

The blogpost about the dotnet v4 SDK also says

It’s a tool to help you see all of Sentry’s telemetry data directly in your development environment, without the need to send anything to Sentry itself.

However this does not seem to be possible, since the SDK will not initialise Sentry without a valid DSN and wil not send anything to Spotlight.

Solution Brainstorm

Requested: when EnableSpotlight = true is passed to SentrySdk.Init, Sentry is always initialized even if there is no DSN. Optional: when Spotlight is enabled, ignore transaction sample rate setting and send everything to Sentry, while still using the configured rate to send to Sentry.

I did not test if the requested behaviour is present in other SDKs, except for the in-browser JS SDK. That one requires a separate Spotlight.init() call outside of Sentry.init and does work without a DSN. For the other SDKs, Spotlight is turned on inside Sentry.init so might also ignore Spotlight if there is no DSN.

bitsandfoxes commented 1 month ago

Thanks for the feedback! I'll have to see what the other SDKs are up to.

It’s a tool to help you see all of Sentry’s telemetry data directly in your development environment, without the need to send anything to Sentry itself.

I can see the being read in a way that you would not expect the events to have to go to Sentry.

bitsandfoxes commented 1 month ago

From what it looks like we should update the SDK to check for Is there a DSN || EnableSpotlight before initializing.

vaind commented 1 month ago

Does spotlight currently work for native events (crashes)? If so, that would also need to be taken into account.

bitsandfoxes commented 1 month ago

AFAIK, it currently does not, no. Oh no, that adds another layer..