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.
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.