Filter data out from system databases for Azure SQL DB only (#8849)

* Excluding data from system databases like msdb,model which are not
relevant for monitoring in Azure SQL

Please enter the commit message for your changes. Lines starting

* Addressing review comments to handle null scenarios
This commit is contained in:
Madhushree Sreenivasa 2021-03-11 13:04:09 -08:00 committed by GitHub
parent 1d8a65069f
commit 35b75e959c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 104 additions and 99 deletions

View File

@ -438,6 +438,10 @@ WITH PerfCounters AS (
ELSE d.[physical_database_name]
END
WHERE
/*filter out unnecessary SQL DB system database counters, other than master and tempdb*/
NOT (spi.object_name LIKE 'MSSQL%:Databases%' AND spi.instance_name IN ('model','model_masterdb','model_userdb','msdb','mssqlsystemresource'))
AND
(
counter_name IN (
'SQL Compilations/sec'
,'SQL Re-Compilations/sec'
@ -540,6 +544,7 @@ WITH PerfCounters AS (
,'Latch Waits/sec'
)
)
)
)
INSERT INTO @PCounters select * from PerfCounters