Disable Dependency Telemetry logs, Python

Ashrith Prakash 0 Reputation points
2025-04-30T18:29:17.15+00:00

I have a function app that has a durable function built with python.

here is my host.json

{
  "version": "2.0",
  "functionTimeout": "00:30:00",
  "logging": {
    "logLevel": {
      "default": "Warning"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request;Dependency",
        "maxTelemetryItemsPerSecond": 10
      },
      "enableLiveMetrics": false,
      "enableDependencyTracking": false
    }
  },
  "telemetryMode": "OpenTelemetry",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  },
  "extensions": {
    "durableTask": {
      "hubName": "CarenoteOrchestrationHub",
      "maxConcurrentActivityFunctions": 10,
      "maxConcurrentOrchestratorFunctions": 10,
      "storageProvider": {
        "partitionCount": 4,
        "trackingStoreNamePrefix": "DurableTask",
        "maxQueuePollingInterval": "00:05:00"  
      },
      "tracing": {
        "traceInputsAndOutputs": false,
        "traceReplayEvents": false
      },
      "useGracefulShutdown": true
    }
  }
}


I am seeing these Dependency logs being made to my storage

Screenshot 2025-04-30 at 11.58.19 PM

how do i disable these?

Also in my function app i have this setting, not sure why i am still seeing those logs and live stream as well

resource = Resource.create({
    "service.name": Config.OTEL_SERVICE_NAME,
    "service.instance.id": os.getenv("WEBSITE_INSTANCE_ID", socket.gethostname())
})
configure_azure_monitor(
    connection_string=os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"),
    instrumentation_options={"azure_sdk": {"enabled": False}, "requests": {"enabled": False}},
    resource=resource,
)

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,776 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Praveen Kumar Gudipudi 440 Reputation points Microsoft External Staff Moderator
    2025-05-12T16:35:25.06+00:00

    Hello Ashrith P,

    Thanks for sharing the answer.

    After you did something like this

    PythonCopy

    
    class StorageSpanFilter(SpanProcessor):
        def on_start(self, span, parent_context):
            if self._should_filter(span):
                # Mark span as non-exportable
                span._context = SpanContext(
                    trace_id=span.context.trace_id,
                    span_id=span.context.span_id,
                    is_remote=span.context.is_remote,
                    trace_flags=TraceFlags(TraceFlags.DEFAULT),
                    trace_state=span.context.trace_state
                )
    
        def _should_filter(self, span):
            return any([
                "applease" in span.name.lower(),
                span.name.startswith(("Azure.Storage.Queues", "Azure.Data.Tables")),
                any(x in span.attributes.get(SpanAttributes.HTTP_URL, "") 
                   for x in ("blob.core.windows.net", "table.core.windows.net"))
            ])
    
    
    # Configure Application Insights / Azure Monitor
    resource = Resource.create({
        "service.name": Config.OTEL_SERVICE_NAME,
        "service.instance.id": os.getenv("WEBSITE_INSTANCE_ID", socket.gethostname())
    })
    configure_azure_monitor(
        connection_string=os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"),
        span_processors=[StorageSpanFilter()],
        instrumentation_options={"azure_sdk": {"enabled": True}},
        resource=resource,
    )
    
    

    and then i changed the host.json to this

    JSONCopy

    {
      "version": "2.0",
      "functionTimeout": "00:30:00",
      "logging": {
        "logLevel": {
          "Azure.Storage": "Warning",
          "Azure.Data.Tables": "Warning",
          "DurableTask.AzureStorage": "Warning",
          "Host.Triggers": "Warning"
        },
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
          }
        }
      },
      "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[4.21.0, 5.0.0)"
      },
      "extensions": {
        "durableTask": {
          "hubName": "CarenoteOrchestrationHub",
          "maxConcurrentActivityFunctions": 5,
          "maxConcurrentOrchestratorFunctions": 5,
          "storageProvider": {
            "partitionCount": 4,
            "trackingStoreNamePrefix": "DurableTask",
            "maxQueuePollingInterval": "00:05:00"
          },
          "useGracefulShutdown": true
        }
      }
    }
    
    

    You do not see the dependency logs like before, also you removed the "telemetryMode": "OpenTelemetry", the live metrics still has some other calls that you see, you can apply filter to filter those out, for now this seems to be working well.

    If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

    User's image

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.