In my ASP.NET app, we are using sentry to log errors, but we want to filter all the APM messages.
I was intending to filter it using the following approaches:
options.SetBeforeSendTransaction((sentryTransaction, hint) =>
{
if (sentryTransaction // somehow look here if it's APM related)
{
return null; // Drop the transaction by returning null
}
return sentryTransaction;
});
or
options.SetBeforeSend((sentryEvent, hint) =>
{
if (sentryEvent //somehow look here if it's APM related) )
{
return null; // Don't send this event to Sentry
}
sentryEvent.ServerName = null; // Never send Server Name to Sentry
return sentryEvent;
});
Problem is I couldn’t find a way to check if it’s apm.
I would look for event type and check if it’s a transaction, but IDK if it’s enough, and the sentryEvent
doesn’t contain a type property.
Can someone help me find a way? Thanks
2
Answers
I ended filtering it by the logger tag
You can set
options.TracesSampleRate = 0
or don’t set this value at all since default is
0
Make sure
EnableTracing
is also set tofalse
. Not a great name for the option but it in essence enables performance monitoring too.