My team had a similar situation where we needed to filter out URLs that were successful image images (we had a lot of these, which is why we reached the limit of 3000 dots / min).
As a result, we used a modified version of this class on a blog in a blog to filter them out.
We created the RequestFilterChannel class, which is an instance of ServerTelemetryChannel and extended the Send method. In this method, we check every telemetry element that will be sent to see if this is a request for an image, and if so, we prevent it from being sent.
public class RequestFilterChannel : ITelemetryChannel, ITelemetryModule { private ServerTelemetryChannel channel; public RequestFilterChannel() { this.channel = new ServerTelemetryChannel(); } public void Initialize(TelemetryConfiguration configuration) { this.channel.Initialize(configuration); } public void Send(ITelemetry item) { if (item is RequestTelemetry) { var requestTelemetry = (RequestTelemetry) item; if (requestTelemetry.Success && isImageRequest((RequestTelemetry) item)) {
After creating the class, you need to add it to the ApplicationInsights.config file.
Replace this line:
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
with reference to your class:
<TelemetryChannel Type="XXX.RequestFilterChannel, XXX" />
source share