Fix perf counters collection on named instances in sqlserver input (#7060)

This commit is contained in:
Giovanni Luisotto 2020-02-21 20:11:50 +01:00 committed by GitHub
parent 3a9062394a
commit 413ca898be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -632,7 +632,7 @@ WHERE (
object_name LIKE '%User Settable%' object_name LIKE '%User Settable%'
OR object_name LIKE '%SQL Errors%' OR object_name LIKE '%SQL Errors%'
) OR ( ) OR (
object_name LIKE 'SQLServer:Batch Resp Statistics%' object_name LIKE '%Batch Resp Statistics%'
) OR ( ) OR (
instance_name IN ('_Total') instance_name IN ('_Total')
AND counter_name IN ( AND counter_name IN (
@ -2302,7 +2302,7 @@ SELECT DISTINCT RTrim(spi.object_name) object_name
, spi.cntr_value , spi.cntr_value
, spi.cntr_type , spi.cntr_type
FROM sys.dm_os_performance_counters spi FROM sys.dm_os_performance_counters spi
WHERE spi.object_name NOT LIKE 'SQLServer:Backup Device%' WHERE spi.object_name NOT LIKE '%Backup Device%'
AND NOT EXISTS (SELECT 1 FROM sys.databases WHERE Name = spi.instance_name); AND NOT EXISTS (SELECT 1 FROM sys.databases WHERE Name = spi.instance_name);
WAITFOR DELAY '00:00:01'; WAITFOR DELAY '00:00:01';
@ -2324,7 +2324,7 @@ SELECT DISTINCT RTrim(spi.object_name) object_name
, spi.cntr_value , spi.cntr_value
, spi.cntr_type , spi.cntr_type
FROM sys.dm_os_performance_counters spi FROM sys.dm_os_performance_counters spi
WHERE spi.object_name NOT LIKE 'SQLServer:Backup Device%' WHERE spi.object_name NOT LIKE '%Backup Device%'
AND NOT EXISTS (SELECT 1 FROM sys.databases WHERE Name = spi.instance_name); AND NOT EXISTS (SELECT 1 FROM sys.databases WHERE Name = spi.instance_name);
SELECT SELECT
@ -2360,7 +2360,7 @@ INNER JOIN #PCounters pc On cc.object_name = pc.object_name
And cc.cntr_type = pc.cntr_type And cc.cntr_type = pc.cntr_type
LEFT JOIN #CCounters cbc On cc.object_name = cbc.object_name LEFT JOIN #CCounters cbc On cc.object_name = cbc.object_name
And (Case When cc.counter_name Like '%(ms)' Then Replace(cc.counter_name, ' (ms)',' Base') And (Case When cc.counter_name Like '%(ms)' Then Replace(cc.counter_name, ' (ms)',' Base')
When cc.object_name = 'SQLServer:FileTable' Then Replace(cc.counter_name, 'Avg ','') + ' base' When cc.object_name like '%FileTable' Then Replace(cc.counter_name, 'Avg ','') + ' base'
When cc.counter_name = 'Worktables From Cache Ratio' Then 'Worktables From Cache Base' When cc.counter_name = 'Worktables From Cache Ratio' Then 'Worktables From Cache Base'
When cc.counter_name = 'Avg. Length of Batched Writes' Then 'Avg. Length of Batched Writes BS' When cc.counter_name = 'Avg. Length of Batched Writes' Then 'Avg. Length of Batched Writes BS'
Else cc.counter_name + ' base' Else cc.counter_name + ' base'
@ -2371,7 +2371,7 @@ LEFT JOIN #CCounters cbc On cc.object_name = cbc.object_name
LEFT JOIN #PCounters pbc On pc.object_name = pbc.object_name LEFT JOIN #PCounters pbc On pc.object_name = pbc.object_name
And pc.instance_name = pbc.instance_name And pc.instance_name = pbc.instance_name
And (Case When pc.counter_name Like '%(ms)' Then Replace(pc.counter_name, ' (ms)',' Base') And (Case When pc.counter_name Like '%(ms)' Then Replace(pc.counter_name, ' (ms)',' Base')
When pc.object_name = 'SQLServer:FileTable' Then Replace(pc.counter_name, 'Avg ','') + ' base' When pc.object_name like '%FileTable' Then Replace(pc.counter_name, 'Avg ','') + ' base'
When pc.counter_name = 'Worktables From Cache Ratio' Then 'Worktables From Cache Base' When pc.counter_name = 'Worktables From Cache Ratio' Then 'Worktables From Cache Base'
When pc.counter_name = 'Avg. Length of Batched Writes' Then 'Avg. Length of Batched Writes BS' When pc.counter_name = 'Avg. Length of Batched Writes' Then 'Avg. Length of Batched Writes BS'
Else pc.counter_name + ' base' Else pc.counter_name + ' base'