Azure/azure-functions-dotnet-worker

Consider config for opting out of Worker Dependency logs

mathewc opened this issue · 0 comments

Description

We should consider providing a config based way for customers to opt out of the default dependency logging the worker does on function invocations (code here). These logs show up as "Invoke" internal dependencies:

Image

Currently the only way for customers to remove these Invoke dependency logs is to write a custom telemetry processr, as in this sample:

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

        // Link processors to each other in the chain.
        public CustomTelemetryProcessor(ITelemetryProcessor next)
        {
            this.Next = next;
        }

        public void Process(ITelemetry telemetry)
        {
            if (telemetry is DependencyTelemetry dependency && dependency.Name == "Invoke")
            {
                // Do not send telemetry for the "Invoke" dependency.
                return;
            }
            // Call the next processor in the chain.
            this.Next.Process(telemetry);
        }
    }

This came up recently in CRI https://portal.microsofticm.com/imp/v5/incidents/details/564586958/summary.