gpt4 book ai didi

azure - 我们如何在azure应用程序洞察中显示数据库查询

转载 作者:行者123 更新时间:2023-12-03 04:43:10 25 4
gpt4 key购买 nike

我们的应用程序正在使用 azure 应用程序见解。我读到的是,使用应用程序洞察端到端跟踪,我们甚至可以获得在数据库中执行的查询以及该查询花费了多少时间。

但如屏幕截图所示,Azure App Insights 显示对数据库进行了 3 次调用,但没有在这些调用中对数据库执行的实际查询。

我需要知道的是我需要做什么才能获取针对数据库执行的查询?

enter image description here

最佳答案

这是 SDK 2.14 中的重大更改之一。

对于 ASP.NET Core,您只需使用以下行修改ConfigureServices():

services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module.EnableSqlCommandTextInstrumentation = true; });

对于 ASP.NET,修改 ApplicationInsights.config 文件:

<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">, 
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
</Add>

关于azure - 我们如何在azure应用程序洞察中显示数据库查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62588803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com