microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
343 stars 60 forks source link

App insights Telemetry for Commands #409

Open JyotikaGargg opened 1 year ago

JyotikaGargg commented 1 year ago

Added a Telemetry package with App Insight resource (the infra would change and so the instrumentation key) We have added for following commands : Create Query Open Config

It also capture if sqlcmd run from : legacy /modern. Following is the snapshot of example commands triggered through sqlcmd and gettig logged in App Insight resource: telemetry

shueybubbles commented 1 year ago

These basic method definitions are good for a POC. It needs to be fleshed out, such as defining an interface for the internal telemetry implementation and using the dependency inversion infrastructure to pass the instance of the interface to the command implementations like we pass other services. We don't want to have all the commands calling a global singleton directly. Tests can provide a mock implementation of that interface to verify the commands log the expected telemetry when run.