IvanJosipovic / BlazorApplicationInsights

Application Insights for Blazor web applications

Home Page:https://BlazorApplicationInsights.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Filtering certain fetch calls

mbaksh01 opened this issue · comments

commented

Hi,

I have a project which is using SignalR. Every time one of the hubs disconnect, the failed fetch gets logged and it bloats my application insights. It also logs every failed attempt to reconnect to the server.

Just wondering if it would be possible to filter out these calls and stop them from being logged as they are of no use to me.

Thanks,
Moe.

I think you would need to use a TelemetryInitializer to do this. This library only has basic integration with this API and doesn't support filtering at this point.

See example here, https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling?tabs=javascriptwebsdkloaderscript#javascript-web-applications

At this point, this can be done manually by adding the TelemetryInitializer to your startup scripts.

TelemetryInitializer will not fully be supported because the call is synchronous and JSInterop must be async.