Proposing feature per https://www.elastic.co/guide/en/beats/devguide/current/beats-contributing.html
Our DBA is looking to have MSSQL deadlocks included in metricbeat mssql performance metricset.
The following query gets this data:
SELECT * FROM sys.dm_os_performance_counters
WHERE counter_name = 'Number of Deadlocks/sec'
AND instance_name = '_Total'
I'm devops, not an experienced dev or familiar with GO, however it seems like everything should work if I just merge this into the query contained in https://github.com/elastic/beats/blob/128787066976ae70630b9379436e5b709135d744/x-pack/metricbeat/module/mssql/performance/performance.go
SELECT object_name,
counter_name,
instance_name,
cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'SQL Compilations/sec'
OR counter_name = 'SQL Re-Compilations/sec'
OR counter_name = 'User Connections'
OR counter_name = 'Page splits/sec'
OR ( counter_name = 'Lock Waits/sec'
AND instance_name = '_Total' )
OR ( counter_name = 'Number of Deadlocks/sec'
AND instance_name = '_Total' )
OR counter_name = 'Page splits/sec'
OR ( object_name = 'SQLServer:Buffer Manager'
AND counter_name = 'Page life expectancy' )
OR counter_name = 'Batch Requests/sec'
OR ( counter_name = 'Buffer cache hit ratio'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Target pages'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Database pages'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Checkpoint pages/sec'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Lock Waits/sec'
AND instance_name = '_Total' )
OR ( counter_name = 'Transactions'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Logins/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Logouts/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Connection Reset/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Active Temp Tables'
AND object_name = 'SQLServer:General Statistics' )
Will do my best to figure out how to test this out and submit a pull request for this change.