Skip to content

How to set Sentry Config in asp.net core IMiddleware #1730

Answered by mattjohnsonpint
anwarjaved asked this question in Q&A
Discussion options

You must be logged in to vote

@anwarjaved - Turns out I was wrong about this in my previous replies. We do have a way to support multiple DSNs in the same application. There's an example app that does that here:
https://github.com/getsentry/sentry-dotnet/blob/main/samples/Sentry.Samples.Console.Customized/Program.cs

Basically, you need a separate SentryClient instance per DSN, then you can apply that client to a particular scope using SentrySdk.BindClient.

In your case, you'd have to pre-create and fill a Dictionary<string, ISentryClient> to map the domain name to the client instance, then configure scope during the request (or in a custom middleware) to pick the appropriate client and bind to it on that scope.

I have…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
9 replies
@mattjohnsonpint
Comment options

@anwarjaved
Comment options

@mattjohnsonpint
Comment options

@anwarjaved
Comment options

@mattjohnsonpint
Comment options

Comment options

You must be logged in to vote
1 reply
@mattjohnsonpint
Comment options

Answer selected by mattjohnsonpint
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #1714 on June 16, 2022 21:28.