3

We developed API Application and published it into Azure using DevOps with two environments like Dev and QA.

In Dev environment we are able to see SQL queries executed by APIs, but in QA environment we are unable to see the SQL queries executed by the APIs.

In Dev environment we see the following in App Insights

Dependency Properties: SQL Command

SELECT TOP (1) [c].[CreatedOn] AS [CreatedOn] FROM [dbo].[__MigrationHistory] AS [c]

For the same call in QA environment the command property is not showing SQL query instead we are seeing the following in the command

Command

tcp:qasqldb01.database.windows.net,1433 | DB_QA

Can you please tell me where did I mistaken and is there any extra configuration needed for QA environment to see the SQL call command?

Pradeep
  • 5,101
  • 14
  • 68
  • 140

2 Answers2

3

In Documenatation(https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-dependencies) is:

For ASP.NET Core applications, It is now required to opt-in to SQL Text collection by using

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

Michal Zemek
  • 81
  • 2
  • 3
0

Getting full dependency info in production requires one or many things depending on environment.

from: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-dependencies

  • IIS Server - Either install Status Monitor on your server or Upgrade your application to .NET framework 4.6 or later and install the Application Insights SDK in your app.
  • Azure Web App - In your web app control panel, open the Application Insights blade in your web app control panel and choose Install if prompted.
  • Azure Cloud Service - Use startup task or Install .NET framework 4.6+

using Status Monitor (kindof misnamed, it doesn't monitor status, it enables monitoring) effectively turns on a .net runtime profiler for the website in IIS, and that profiler collects additional dependency information from the .net runtime.

features of .net 4.6+ enable some of that collection from code itself inside the runtime instead of having to run separately as a profiler.

John Gardner
  • 24,225
  • 5
  • 58
  • 76
  • 1
    I already setup application insights to my QA environment of web app. I get the complete details of SQL dependency calls with SQL commands but in QA environment I am not able to see the complete details of SQL dependency calls with SQL commands. – Pradeep Apr 13 '17 at 06:17
  • 1
    if it works in one place, but doesn't work in the other, then the configurations on the 2 environments are not the same. one is on .net45 and the other on .net46, or one has status monitor, etc. – John Gardner Apr 14 '17 at 19:51
  • 1
    I'm struggling with this as well. My cloud service has the latest SDK, is running .NET 4.6, and I see other telemetry - but not the full sql text. – RMD Apr 25 '18 at 22:40
  • 1
    I believe things like sql text, you also need to be using the status monitor, like above. it runs as a profiler and can collect that data. – John Gardner Apr 27 '18 at 17:36
  • 3
    I did not get detailed information about SQL queries, until I installed Status Monitor and restarted IIS. I did not get detailed information before, although I targeted application for .Net Framework 4.6.1 and I had installed application Insights SDK in my app. – Rudolf Dvoracek Aug 20 '18 at 08:56