Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Log SQL command #27

Closed
dude0001 opened this issue Jul 18, 2016 · 3 comments
Closed

Log SQL command #27

dude0001 opened this issue Jul 18, 2016 · 3 comments
Labels

Comments

@dude0001
Copy link

When I've used Application Insights with ASP.NET applications, the SQL dependency logs include the actual SQL command/query that was sent to SQL Server. When using this package for a WCF service I see SQL dependencies being logged, but the command property only contains the server and database my app is hitting and not the actual SQL command/query. I get timing and frequency data, but that information isn't helpful without knowing what the source was. Is there a way to enable this or is this something that needs developed for this package?

@abaranch
Copy link
Contributor

WCF nuget package is responsible only for request and exception collection which is specific for WCF. Dependency collection is done the same way as in Web and comes with Dependency nuget package. Command name collection depends on whether you use StatusMonitor or not.
Some details here: microsoft/ApplicationInsights-Announcements#9

@dude0001
Copy link
Author

My WCF service does reference Microsoft.ApplicationInsights.DependencyCollector and it targets .NET 4.6.1, so I thought the CommandText should be logged automatically from my experience in ASP.NET applications. I thought my issue had something to do with using this package and being a WCF service but it must be something else. I'll do some more research and direct further questions to the announcement thread you referenced for the Microsoft.ApplicationInsights.DependencyCollector package.

@abaranch
Copy link
Contributor

Wcf nuget package depends on Application Insights Windows Server nuget. Application Insights Windows Server depends on Microsoft.ApplicationInsights.DependencyCollector . The last one automatically collects dependencies for 4.6. But command text is available only if you also have StatusMonitor. You do not have to onboard your application using StatusMonitor. You just need to

  1. host your application in IIS (we need the process to be w3wp.exe)
  2. install status monitor on the same box with your application
  3. restart IIS after StatusMonitor is installed. (StatusMonitor does not have to be started after that)

StatusMonitor brings in a profiler so we can collect more information. Without it collection is based on .Net framework instrumentation which does not give us command text.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants