简体   繁体   中英

Application Insights Codeless attach Status Monitor V2

im using Application Insight Codeless Attach over IIS with Status Monitor v2.

Everything works great, the only thing is that im not able to see SQL CommandText over the insights.

In addition to the platform specific steps above, you must also explicitly opt-in to enable SQL command collection by modifying the applicationInsights.config file with the following:

The application folder does not have any applicationInsights.config file so is not possible to add the following:

<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>

I've also tried to change the ApplicationInsights-default.config and ApplicationInsights-recommended.config files under "ApplicationMonitor\version\content\runtime" without success.

Does somebody know how to add this property without code implementation?

As this doc mentioned, IIS server need to use Microsoft.Data.SqlClient instead of System.Data.SqlClient .

requires using the instrumentation engine or by using the Microsoft.Data.SqlClient NuGet package instead of the System.Data.SqlClient library

在此处输入图像描述

===========================Test result=====================

I created a test asp.net core mvc app and used Microsoft.Data.SqlClient , after deploying to azure web app and enable application insights, I can see sql query text like below.

在此处输入图像描述

I get it working without using Microsoft.Data.SqlClient and without a single line of code in the application. Just using status monitor v2, enabling instrumentation and adding -connectionstring instead of -instrumentationkey or -instrumentationkeymap. The problem with this approach is that when you deploy an app looks like the instrumentation service stop getting the sqlcommandtext until you restart it –

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM