ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Do not report ServiceBus receive and AcceptMessageSession calls that result in timeout

Open lmolkova opened this issue 5 years ago • 17 comments

https://github.com/Azure/azure-sdk-for-net/issues/6813 https://github.com/microsoft/ApplicationInsights-dotnet-server/issues/1259

There is not much value in reporting certain calls from ServiceBus. They could be empty receive calls that end up in timeout (no messages on the Bus).

We need to review calls we collect and see which of them are useful.

lmolkova avatar Oct 02 '19 18:10 lmolkova

Any news here? When is a fix to be expected. It bloats the AI with logs over and over with Dependency call failures.

lukasvosyka avatar Mar 27 '20 13:03 lukasvosyka

Hi,

we are trying to get rid of the "AcceptMessageSession" errors when using Service bus client and a SerivceBusTimeoutException happens. As I understand it is "not an issue" since it recovers internally, but how do I get access to the very underlying exception during ITelemetryProcessor?

In VS I do see in the Debugger / Local apparentely the $exception listed, which seems to be the underlying exception, but don't know how to use the pipeline to access it in a proper way..

This is my current approach though. Any hint is highly appreciated :) @lmolkova

public class SkipAcceptMessageSessionDependencyFailuresTelemetryProcessor : ITelemetryProcessor
{
	private ITelemetryProcessor Next { get; set; }

	// next will point to the next TelemetryProcessor in the chain.
	public SkipAcceptMessageSessionDependencyFailuresTelemetryProcessor(ITelemetryProcessor next)
	{
		this.Next = next;
	}

	public void Process(ITelemetry item)
	{
		// To filter out an item, return without calling the next processor.
		if (FilterTelemetry(item)) { return; }

		this.Next.Process(item);
	}

	private bool FilterTelemetry(ITelemetry item)
	{
		var dependency = item as DependencyTelemetry;
		if (dependency == null) return false;

		return dependency.Type == "Azure Service Bus" && dependency.Name == "AcceptMessageSession" && dependency.Success != true;
	}
}

lukasvosyka avatar Mar 28 '20 01:03 lukasvosyka

Any update here?

kevine323 avatar Aug 04 '20 14:08 kevine323

Sorry, don't have any updates on this.

cijothomas avatar Aug 10 '20 15:08 cijothomas

Today we noticed also thousands of failed 'AcceptMessageSession' logs under 'Dependencies' tab. This is really annoying...

IT-CASADO avatar Apr 14 '21 09:04 IT-CASADO

I think we're having the same issue. We are using ServiceBusProcessor to receive messages and a default app insights configuration with AddApplicationInsightsTelemetryWorkerService(). The result is below on a screenshot. Would be great to get rid of these log entries without any additional filtering code

=================================

image

kiseln avatar Apr 21 '21 15:04 kiseln

This has been ongoing for quite some time. Any update on a fix?

kevine323 avatar May 03 '21 19:05 kevine323

I also experience this error. Is there any plan to fix it?

s-krawczyk avatar Jun 22 '21 11:06 s-krawczyk

I have the same issue

Marusyk avatar Jul 07 '21 18:07 Marusyk

I think we're having the same issue. We are using ServiceBusProcessor to receive messages and a default app insights configuration with AddApplicationInsightsTelemetryWorkerService(). The result is below on a screenshot. Would be great to get rid of these log entries without any additional filtering code

=================================

image

I was going to raise an issue relating to what I can see in this screenshot. Shouldn't this telemetry at least be sent as a dependency rather than a request? As a work around I'm currently filtering out ServiceBusReceiver.Receive using a telemetry processor as it's bloating the logs

ben-burton avatar Aug 11 '21 08:08 ben-burton

@ben-burton any chance you could share that telemtry processor, because its annoying as hell and we also want to filter it out.

esbenbach avatar Sep 14 '21 18:09 esbenbach

@esbenbach sure here is my ITelemetryProcessor

namespace ExampleNamespace
{
    using System.Collections.Generic;
    using Microsoft.ApplicationInsights.Channel;
    using Microsoft.ApplicationInsights.Extensibility;
    using Microsoft.ApplicationInsights.Extensibility.Implementation;

    public class TelemetryFilterProcessor : ITelemetryProcessor
    {
        private readonly ITelemetryProcessor _next;
        private readonly HashSet<string> _excludedTelemetryNames;

        public TelemetryFilterProcessor(ITelemetryProcessor next, HashSet<string> excludedTelemetryNames = null)
        {
            _next = next;
            _excludedTelemetryNames = excludedTelemetryNames ?? new HashSet<string>();
        }

        public void Process(ITelemetry item)
        {
            if (OkToSend(item))
            {
                _next.Process(item);
            }
        }

        private bool OkToSend(ITelemetry item)
        {
            if (!(item is OperationTelemetry operationTelemetry))
            {
                return true;
            }

            return !_excludedTelemetryNames.Contains(operationTelemetry.Name);
        }
    }
}

and how it could be used

var builder = TelemetryConfiguration.CreateDefault().TelemetryProcessorChainBuilder;

builder.Use(next => new TelemetryFilterProcessor(next, 
    new HashSet<string>
    {
        "ServiceBusReceiver.Receive"
    }));
builder.Build();

If you want to use the services.AddApplicationInsightsTelemetryProcessor<> way of configuring App Insights then see this link for ideas how to use DI to pass in the excludedTelemetryNames: https://github.com/microsoft/ApplicationInsights-dotnet/issues/1563#issuecomment-400095415

ben-burton avatar Sep 15 '21 09:09 ben-burton

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Jul 13 '22 00:07 github-actions[bot]

It still needs fixing so we dont have to provider our own workaround.

On Wed, 13 Jul 2022, 02:05 github-actions[bot], @.***> wrote:

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/ApplicationInsights-dotnet/issues/1348#issuecomment-1182611465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKQP7S2DR5GGR6VI2PACD3VTYB4LANCNFSM4JVQA6OQ . You are receiving this because you were mentioned.Message ID: @.***>

esbenbach avatar Jul 13 '22 05:07 esbenbach

I am also facing the same issue, TelemetryProcessor is not getting added in workerservice https://github.com/microsoft/ApplicationInsights-dotnet/issues/2726. Appreciate any suggestions

vikneshrajspui avatar Dec 22 '22 15:12 vikneshrajspui

Any update?

remcoros avatar Mar 01 '23 12:03 remcoros

Any update?

Gustavo-Marques19 avatar Jun 12 '23 19:06 Gustavo-Marques19