我将 ILogger ( Microsoft.Extensions.Logging
) 与应用程序洞察一起使用。我想知道在使用时BeginScope()
如何自动跟踪所有依赖项,如果可能的话?
例如,这段代码:
using (var scope = this.logger.BeginScope(new Dictionary<string, string>
{
{ "Reference", "HelloWorld" }
}))
{
this.logger.LogDebug("Foo");
this.logger.LogInformation("Bar.");
var response = await this.httpClient.PostAsync(..); // dependency tracking
}
这会将Reference
字段记录为跟踪上的自定义维度,但是,依赖项条目没有任何自定义维度。这必须手动完成还是我错过了什么?
应该详细说明,这些 ^^ 未附加到跟踪的依赖项条目,我正在使用托管服务并通过以下方式连接应用程序洞察力services.AddApplicationInsightsTelemetryWorkerService()