添加注入的 TelemetryConfiguration 后,Azure Functions v3 不再自动跟踪依赖项
Azure Functions v3 no longer auto-tracking dependencies after adding injected TelemetryConfiguration
目前在 .netcore 3.1 中有一个 azure 函数 v3,具有以下 host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": false,
"excludedTypes": "Exception"
},
"dependencyTrackingOptions": {
"enableSqlCommandTextInstrumentation": true
}
},
"logLevel": {
"Function": "Information",
"Host.Aggregator": "Information",
"Host.Results": "Information",
"default": "Warning"
}
}
}
在应用洞察中自动跟踪 SQL 依赖项,一切正常。还需要跟踪 redis 调用,我按照
的建议通过依赖注入添加了 telemetryClient
telemetryClient = new TelemetryClient(telemetryConfiguration);
然而,在这样做之后,我只收到我通过遥测客户端手动编写的依赖调用,不再收到默认的 SQL 调用。
我试过手动创建 DependencyCollector.DependencyTrackingTelemetryModule
并使用注入的 telemetryConfiguration 和设置对其进行初始化
EnableSqlCommandTextInstrumentation = true
,但尽管这确实启用了 SQL 跟踪,但它不会将其绑定到调用上下文。
有没有人运行之前遇到过这个问题,或者对如何正确实施自定义遥测同时保持默认依赖项跟踪有任何建议?
已将 Microsoft.Azure.WebJobs.Logging.ApplicationInsights 降级为与 Microsoft.NET.Sdk.Functions 相同的版本,并且有效。
目前在 .netcore 3.1 中有一个 azure 函数 v3,具有以下 host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": false,
"excludedTypes": "Exception"
},
"dependencyTrackingOptions": {
"enableSqlCommandTextInstrumentation": true
}
},
"logLevel": {
"Function": "Information",
"Host.Aggregator": "Information",
"Host.Results": "Information",
"default": "Warning"
}
}
}
在应用洞察中自动跟踪 SQL 依赖项,一切正常。还需要跟踪 redis 调用,我按照
的建议通过依赖注入添加了 telemetryClienttelemetryClient = new TelemetryClient(telemetryConfiguration);
然而,在这样做之后,我只收到我通过遥测客户端手动编写的依赖调用,不再收到默认的 SQL 调用。
我试过手动创建 DependencyCollector.DependencyTrackingTelemetryModule
并使用注入的 telemetryConfiguration 和设置对其进行初始化
EnableSqlCommandTextInstrumentation = true
,但尽管这确实启用了 SQL 跟踪,但它不会将其绑定到调用上下文。
有没有人运行之前遇到过这个问题,或者对如何正确实施自定义遥测同时保持默认依赖项跟踪有任何建议?
已将 Microsoft.Azure.WebJobs.Logging.ApplicationInsights 降级为与 Microsoft.NET.Sdk.Functions 相同的版本,并且有效。