我有一个python azure函数,它从blob存储中获取数据。
import azure.functions as func
from azure.storage.blob import BlobServiceClient
from azure.identity import DefaultAzureCredential
def main(req: func.HttpRequest) -> func.HttpResponse:
default_credential = DefaultAzureCredential(exclude_shared_token_cache_credential=True)
blob_storage_uri = "https://mystorage.blob.core.windows.net"
blob_service_client = BlobServiceClient(blob_storage_uri, credential=default_credential)
container_client = blob_service_client.get_container_client("my-container")
blob_client = container_client.get_blob_client("files/stefan/my_file.json")
blob_data = blob_client.download_blob().readall()
return func.HttpResponse(blob_data, status_code=200)
字符串
我希望跟踪从blob存储获取数据的情况,并使用应用洞察依赖项:
的数据
我的host.json看起来像这样:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"enableDependencyTracking": true,
"dependencyTrackingOptions": {
"enableSqlCommandTextInstrumentation": true
},
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request;Exception;Dependency"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
}
型
我还能怎么办?
1条答案
按热度按时间yyhrrdl81#
log_dependency
中使用了Azure Blob存储名称log_dependency
记录具有目标"sampath23.blob.core.windows.net"
和名称"get_blob"
的Azure Blob存储依赖项,并将其与请求和异常关联。设置依赖跟踪的示例代码:
字符串
在Azure Application Insights中:
的
跟踪依赖关系:
型
的
的