Is it possible to disable the SentryMessageHandler/SentryHttpMessageHandler? #3671
-
Hi, When I add the Sentry client, it's automatically adding this handler to every HTTP Client. However, there's an access token endpoint I use that doesn't like the extra headers added and the request is dropped (a firewall like behaviour). Is it possible to disable this behavior in any way? Looking through the code I don't currently see any possibility of this? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey @evolvedlight, Which headers are causing you problems? I'm thinking that they may be headers that Sentry requires... |
Beta Was this translation helpful? Give feedback.
-
Apologies for the slow response - I was maybe only 50% correct in what I said above: the issue is that my service also has to make a request to a oauth token endpoint that is unrelated to anything sentry. The issue is that this oauth provider has "hardened" their endpoint and it rejects any requests with headers over a certain size. sentry-dotnet/src/Sentry/BaggageHeader.cs Line 11 in a18bef3 This baggage header gets quite large, the endpoint hardening/firewall solution rejects this large header, and thus my app can't get access tokens when this tracing is applied. I'd done this: c.TracesSampler = (_) => null; But that didn't seem to work, oddly. |
Beta Was this translation helpful? Give feedback.
-
In the end, the actual problem was this: I wanted to disable the traces, but had this line: |
Beta Was this translation helpful? Give feedback.
Ah I see... thanks @evolvedlight. Yes the baggage headers would be passed on regardless as we don't want to break downstream tracing in a scenario where you have Service A (tracing enabled - creates baggage headers) -> Service B (using .NET SDK) -> Service C (tracing enabled - wants baggage headers).
I assume you're using
Sentry.Extensions.Logging
since that appears the be the only integration that automatically adds the SentryMessageHandler (via an implementation ofIHttpMessageHandlerBuilderFilter
):sentry-dotnet/src/Sentry.Extensions.Logging/SentryHttpMessageHandlerBuilderFilter.cs
Lines 17 to 22 in dcc32b2