You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ISentryEventProcessor doesn't do anything for transactions #1468
Which SDK and version?
Sentry.AspNetCore 3.13 used in dotnetcoreapp2.2 API project
Steps to Reproduce
I created an ISentryEventProcessor like the example one
public class ExampleEventProcessor : ISentryEventProcessor
{
private readonly IHttpContextAccessor _httpContext;
public ExampleEventProcessor(IHttpContextAccessor httpContext) => _httpContext = httpContext;
public SentryEvent Process(SentryEvent @event)
{
// Here I can modify the event, while taking dependencies via DI
@event.SetExtra("Response:HasStarted", _httpContext.HttpContext?.Response.HasStarted);
return @event;
}
}
Registered in my Startup.cs like so
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<ISentryEventProcessor, ExampleEventProcessor>();
...
When I call and endpoint I see the transaction in Sentry but breakpoints in the EventProcessor are never triggered and it doesn't run.
I would like to use this to override properties of the event.
What am I doing wrong?
Expected Result
EventProcessor is triggered for a transaction when I call an endpoint in the API
Is there a way to filter data from a transaction? I thought both BeforeSend and ISentryEventProcessor may work, but neither does. Right now, the SDK includes all environment variables and authentication cookies when publishing transactions, both of which include sensitive/secret data.
But we can't use that in .NET while maintaining backwards compat with .NET 4x and old .NET Core versions.
We could add a new interface for processing transactions, or bump a major and add a new overload that takes Transaction to the current IEventProcessor interface (which is my preference).
I think I'd rather implement a new interface, ISentryTransactionProcessor. The other approach mentioned would require all event processors to also process transactions, which shouldn't be necessary in all cases, IMHO.
This should probably be added to the documentation in the interim so that users know about this limitation -- until I found this issue, I had spent a few hours trying to get this to work and thought I was doing something wrong.
Just to throw in my 2 cents, having this functionality would let me anonymize users and IP addresses to enhance user privacy while still being able to get affected user counts and rough GeoIP data.
Is there another way to do filtering on everything (including transactions) that is currently available in the SDK?
@craigbehnke - Unfortunately there's currently no way to do filtering globally either. We need to rethink this for the next large set of breaking changes (4.x release), but that is an end-of-year goal.
In the shorter term, we can add transaction processors without breaking anything. Look for it in the upcoming 3.20.0 or 3.21.0 releases (likely within the next few weeks).
Activity
lucas-zimerman commentedon Feb 7, 2022
Hi seanarmstrong87.
Currently EventProcessors only are applied to events but not Transactions
ccurrens commentedon Mar 3, 2022
Is there a way to filter data from a transaction? I thought both
BeforeSendandISentryEventProcessormay work, but neither does. Right now, the SDK includes all environment variables and authentication cookies when publishing transactions, both of which include sensitive/secret data.It seems the javascript SDK has support for
globalEventProcessor, but I can't find an equivalent in the .NET SDK.bruno-garcia commentedon Mar 3, 2022
We haven't added a hook to drop transaction other than the
TracesSamplercallback which happens at the start of the transaction.In Java we used default interface method so it wasn't a breaking change: https://github.com/getsentry/sentry-java/blob/4afe30c18e7f13d53d5b17afd7d7925351d14a8b/sentry/src/main/java/io/sentry/EventProcessor.java#L32-L33
But we can't use that in .NET while maintaining backwards compat with .NET 4x and old .NET Core versions.
We could add a new interface for processing transactions, or bump a major and add a new overload that takes Transaction to the current
IEventProcessorinterface (which is my preference).mattjohnsonpint commentedon Apr 7, 2022
I think I'd rather implement a new interface,
ISentryTransactionProcessor. The other approach mentioned would require all event processors to also process transactions, which shouldn't be necessary in all cases, IMHO.mattjohnsonpint commentedon Apr 7, 2022
@bruno-garcia - Should there also be a
BeforeSendTransactionoption?mattjohnsonpint commentedon Apr 8, 2022
Also, it would appear transactions don't participate in a scope. Should they? (Event Processors and Exception Processors can both be set on a scope.)
craigbehnke commentedon Jul 17, 2022
This should probably be added to the documentation in the interim so that users know about this limitation -- until I found this issue, I had spent a few hours trying to get this to work and thought I was doing something wrong.
Just to throw in my 2 cents, having this functionality would let me anonymize users and IP addresses to enhance user privacy while still being able to get affected user counts and rough GeoIP data.
Is there another way to do filtering on everything (including transactions) that is currently available in the SDK?
mattjohnsonpint commentedon Jul 18, 2022
@craigbehnke - Unfortunately there's currently no way to do filtering globally either. We need to rethink this for the next large set of breaking changes (4.x release), but that is an end-of-year goal.
In the shorter term, we can add transaction processors without breaking anything. Look for it in the upcoming 3.20.0 or 3.21.0 releases (likely within the next few weeks).