Tracking dependencies with Application Insights
See original GitHub issueWe are deploying our .NET Core application(s) on Azure, using Azure AppServices and Azure Database for PostgreSQL server.
We’ve started to add Application Insights, and most of the external dependencies are automatically tracked/graphed, except for the database. For example, I can see all interactions and timing to the Storage accounts, or an external REST API, but not the SQL queries and number of instances in a request to a database.
According to the Azure documentation, SQL dependencies are automatically tracked via the SqlClient
, with nothing more to do for .NET Core. However, I’m assuming that the Npgsql provider doesn’t use the SqlClient
under the hood.
Is there anything I can configure in the Npgsql EF Core provider that will allow for the automatic tracking of Sql queries and dependencies, or is it coming in v5?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:7 (2 by maintainers)
I was able to add dependency calls by using the OpenTelemetry-package (requires net6.0): https://www.npgsql.org/doc/diagnostics/tracing.html
Then use the Azure Monitor Exporter-package (Link) to export your OpenTelemetry to Application Insights.
Add this to ConfigureServices-method:
@froens thanks, that’s great to hear!
I’m planning to further improve Npgsql’s OpenTelemetry support - this will be Npgsql’s main focus where diagnostics/observability is concerned. I’ll go ahead and close this issue as we shouldn’t need to do anything specific for Application Insights.