0

Is there a way to hide the microsft table activity when viewing the full length of the distributed trace...

If I have dozens of sub activities and orchestrations, having this additional noise is really going to get cluttered.

enter image description here

I've tried adding Warning level rules in logging, but no effect?

hosts.json

{
  "version": "2.0",
  "telemetryMode": "OpenTelemetry",
  "logging": {
    "logLevel": {
      "default": "Warning",
      "DurableTask.AzureStorage": "Warning",
      "DurableTask.Core": "Warning",
      "Microsoft": "Warning",
      "Host.Triggers.DurableTask": "Information",
      "Function": "Information",
      "Function.http_trigger_2": "Warning",
      "Function.say_hello": "Warning"
    }
  },
  "extensions": {
     "durableTask": {
       "tracing": {
         "distributedTracingEnabled": true,
         "version": "V2"
       }
     }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  }
}
1
  • Filter out DurableTask.AzureStorage table storage activity using custom ITelemetryProcessor. Commented May 21 at 11:57

1 Answer 1

0

Below host.json affects log verbose but not the opentelemetry logs.

"logging": {
  "logLevel": {
    "DurableTask.AzureStorage": "Warning"
  }
}

Implement a TelemetryProcessor to hide storage spans as shown below:

  1. Create a custom TelemetryProcessor class in the function project.
public  class  DurableStorage : ITelemetryProcessor 
{ 
    private ITelemetryProcessor Next { get; } 
    public  DurableStorage(ITelemetryProcessor next)
    {
        Next = next;
    } 
    public  void  Process(ITelemetry item)
    { 
        { if (dep.Type == "Azure table" && dep.Name.Contains("DurableTask"))
            { return;  
            } 
            if (dep.Data != null && dep.Data.Contains("DurableTask"))
            { return; 
            }
        }

        Next.Process(item);
    }
} 
  1. Register the TelemetryProcessor in program.cs:
var builder = FunctionsApplication.CreateBuilder(args);

builder.ConfigureFunctionsWebApplication();

builder.Services
  .AddApplicationInsightsTelemetryWorkerService();
   .ConfigureFunctionsApplicationInsights();
builder.Services.AddOptions<KestrelServerOptions>()
.Configure<IConfiguration>((settings, configuration) =>
{
    settings.AllowSynchronousIO = true;
});

builder.Services.AddSingleton<ITelemetryProcessorFactory, FilterProcessorFactory>();

builder.Build().Run();

This will filter DependencyTelemetry with type Azure table Name or Data that contains"DurableTask".

You can use below Python Code Snippet to achieve the same:

from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.trace import execution_context

def telemetry_processor(envelope):

    if envelope.name == "RemoteDependency" and "Table" in envelope.data.get("baseData", {}).get("type", ""):
        return False 
    return True  # Allow all other telemetry

exporter = AzureExporter(connection_string="InstrumentationKey=YOUR_KEY")
exporter.add_telemetry_processor(telemetry_processor)

tracer = Tracer(exporter=exporter, sampler=ProbabilitySampler(1.0))
execution_context.set_opencensus_attr("tracer", tracer)

Sign up to request clarification or add additional context in comments.

2 Comments

is this only possible in a .NET C# function, for a python / typescript / powershell function is it easy to implement a new telemetry processor?
I have provided the Python code to achieve your requirement in the updated answer. Please check if it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.