Tags are not being sent through SentrySdk.CaptureException? .NET 7 API #2497
-
Hello, I have an .net 7 api with the follwoing sentry setup: This default tag is show in the event. But when I add other tags:
These Tags arn't visbile. Not the ErrorType nor the transaction_id. There are also no later scopes being set or overwriten. But I would also think that this should not be posible as the scope is incapsulated in the CaptureException. And should not have effect on other events nor should other events have effect on this event. I also tried other methods like SentrySdk.ConfigureScope with SentrySdk.PushScope() or the older SentrySdk.WithScope( but nothing seems to solve my problem. Any ideas what I might be missing here? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I created a new .NET 7 WebAPI added:
and:
And this does work. Checking out the differences and will update the findings here. |
Beta Was this translation helpful? Give feedback.
-
The capture exception was never entering sentry. I was doing a log entry right before it: This somehow prevented the captureexception from ending up in sentry: Not sure yet why this is the case? |
Beta Was this translation helpful? Give feedback.
-
Hey @platform-co , If you configure Sentry with the Debug option I think you'll see a Debug log message explaining what's going. builder.WebHost.UseSentry(options => {
// ... other options
options.DefaultTags.Add("DefaultTag", "Initial");
options.Debug = true;
}); I think you'll see something like the following in your Debug Output when you do this:
Essentially the exception is being sent through to sentry twice. Once when you call One solution is that you don't pass the exception as a first parameter to _logger.LogError("A resolver error occurred: [{Code}] {Message}", error.Code, error.Message); In Sentry, the |
Beta Was this translation helpful? Give feedback.
Hey @platform-co ,
If you configure Sentry with the Debug option I think you'll see a Debug log message explaining what's going.
I think you'll see something like the following in your Debug Output when you do this:
Essentially the exception is being sent through to sentry twice. Once when you call
_logger.LogError
and once when you callSentrySdk.CaptureException
... so sentry drops the second one.One solution is that you don't pass the exception as a first parameter to
_logger.Lo…