Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Lite/Services/RemoteCollectorService.FileIo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ LEFT JOIN sys.database_files AS df
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT
database_name = DB_NAME(vfs.database_id),
database_name = ISNULL(d.name, N'Unknown'),
file_name = mf.name,
file_type = mf.type_desc,
physical_name = mf.physical_name,
Expand All @@ -78,6 +78,8 @@ FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS vfs
LEFT JOIN sys.master_files AS mf
ON mf.database_id = vfs.database_id
AND mf.file_id = vfs.file_id
LEFT JOIN sys.databases AS d
ON d.database_id = vfs.database_id
WHERE (vfs.database_id > 4 OR vfs.database_id = 2)
AND vfs.database_id < 32761
AND vfs.database_id <> ISNULL(DB_ID(N'PerformanceMonitor'), 0)
Expand Down
15 changes: 9 additions & 6 deletions Lite/Services/RemoteCollectorService.ProcedureStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ CROSS APPLY
FROM sys.dm_exec_plan_attributes(s.plan_handle) AS pa
WHERE pa.attribute = N''dbid''
) AS pa
LEFT JOIN sys.databases AS d
INNER JOIN sys.databases AS d
ON pa.dbid = d.database_id
WHERE pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
WHERE d.state = 0
AND pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
AND s.last_execution_time >= DATEADD(MINUTE, -10, GETDATE())

UNION ALL
Expand Down Expand Up @@ -130,9 +131,10 @@ CROSS APPLY
FROM sys.dm_exec_plan_attributes(s.plan_handle) AS pa
WHERE pa.attribute = N''dbid''
) AS pa
LEFT JOIN sys.databases AS d
INNER JOIN sys.databases AS d
ON pa.dbid = d.database_id
WHERE pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
WHERE d.state = 0
AND pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
AND s.last_execution_time >= DATEADD(MINUTE, -10, GETDATE())

UNION ALL
Expand Down Expand Up @@ -171,9 +173,10 @@ CROSS APPLY
FROM sys.dm_exec_plan_attributes(s.plan_handle) AS pa
WHERE pa.attribute = N''dbid''
) AS pa
LEFT JOIN sys.databases AS d
INNER JOIN sys.databases AS d
ON pa.dbid = d.database_id
WHERE pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
WHERE d.state = 0
AND pa.dbid NOT IN (1, 3, 4, 32761, 32767, ISNULL(DB_ID(N''PerformanceMonitor''), 0))
AND s.last_execution_time >= DATEADD(MINUTE, -10, GETDATE())
) AS combined
ORDER BY total_elapsed_time DESC
Expand Down
4 changes: 3 additions & 1 deletion Lite/Services/RemoteCollectorService.QuerySnapshots.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

SELECT /* PerformanceMonitorLite */
der.session_id,
database_name = DB_NAME(der.database_id),
database_name = d.name,
elapsed_time_formatted =
CASE
WHEN der.total_elapsed_time < 0
Expand Down Expand Up @@ -72,6 +72,8 @@
ON des.session_id = der.session_id
OUTER APPLY sys.dm_exec_sql_text(COALESCE(der.sql_handle, der.plan_handle)) AS dest
OUTER APPLY sys.dm_exec_text_query_plan(der.plan_handle, der.statement_start_offset, der.statement_end_offset) AS deqp
LEFT JOIN sys.databases AS d
ON d.database_id = der.database_id
{1}
WHERE der.session_id <> @@SPID
AND der.session_id >= 50
Expand All @@ -87,8 +89,8 @@
internal static string BuildQuerySnapshotsQuery(bool supportsLiveQueryPlan)
{
return supportsLiveQueryPlan
? string.Format(QuerySnapshotsBase, "live_query_plan = deqs.query_plan,", "OUTER APPLY sys.dm_exec_query_statistics_xml(der.session_id) AS deqs")

Check warning on line 92 in Lite/Services/RemoteCollectorService.QuerySnapshots.cs

View workflow job for this annotation

GitHub Actions / build

Cache a 'CompositeFormat' for repeated use in this formatting operation (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863)

Check warning on line 92 in Lite/Services/RemoteCollectorService.QuerySnapshots.cs

View workflow job for this annotation

GitHub Actions / build

Cache a 'CompositeFormat' for repeated use in this formatting operation (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863)
: string.Format(QuerySnapshotsBase, "live_query_plan = CONVERT(xml, NULL),", "");

Check warning on line 93 in Lite/Services/RemoteCollectorService.QuerySnapshots.cs

View workflow job for this annotation

GitHub Actions / build

Cache a 'CompositeFormat' for repeated use in this formatting operation (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863)

Check warning on line 93 in Lite/Services/RemoteCollectorService.QuerySnapshots.cs

View workflow job for this annotation

GitHub Actions / build

Cache a 'CompositeFormat' for repeated use in this formatting operation (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863)
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion Lite/Services/RemoteCollectorService.WaitingTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ private async Task<int> CollectWaitingTasksAsync(ServerConnection server, Cancel
wait_type = wt.wait_type,
wait_duration_ms = wt.wait_duration_ms,
blocking_session_id = wt.blocking_session_id,
database_name = DB_NAME(er.database_id)
database_name = d.name
FROM sys.dm_os_waiting_tasks AS wt
LEFT JOIN sys.dm_exec_requests AS er
ON er.session_id = wt.session_id
LEFT JOIN sys.databases AS d
ON d.database_id = er.database_id
WHERE wt.session_id >= 50
AND wt.session_id <> @@SPID
AND wt.wait_type IS NOT NULL
Expand Down
Loading