Skip to content

Commit 07303a5

Browse files
BrentOzarclaude
andcommitted
Distinguish missing vs inactive session in Azure system_health check
Address review feedback: only show the friendly "not available" message when the system_health session truly doesn't exist in sys.database_event_sessions. If someone creates a database-scoped session named system_health but forgets to START it, they now get the original severity-11 "does not exist or is not currently active" error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e2d85ed commit 07303a5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sp_BlitzLock.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,13 @@ BEGIN
571571
)
572572
BEGIN
573573
IF @EventSessionName = N'system_health'
574+
AND NOT EXISTS
575+
(
576+
SELECT
577+
1/0
578+
FROM sys.database_event_sessions AS ses
579+
WHERE ses.name = @EventSessionName
580+
)
574581
BEGIN
575582
RAISERROR('
576583
The system_health extended events session is not available in Azure SQL DB.

0 commit comments

Comments
 (0)