fix(inputs.sqlserver): SqlRequests include sleeping sessions with open transactions (#12386)

This commit is contained in:
Gianluca Sartori 2022-12-16 14:28:15 +01:00 committed by GitHub
parent 7fb90a2d9c
commit 82555d3e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -355,7 +355,7 @@ The new (version 2) metrics provide:
- *Wait stats*: Wait time in ms, number of waiting tasks, resource wait time, signal wait time, max wait time in ms, wait type, and wait category. The waits are categorized using the same categories used in Query Store.
- *Schedulers* - This captures `sys.dm_os_schedulers`.
- *SqlRequests* - This captures a snapshot of `sys.dm_exec_requests` and `sys.dm_exec_sessions` that gives you running requests as well as wait types and
blocking sessions. Telegraf's monitoring request is omitted unless it is a heading blocker.
blocking sessions. Telegraf's monitoring request is omitted unless it is a heading blocker. Also includes sleeping sessions with open transactions.
- *VolumeSpace* - uses `sys.dm_os_volume_stats` to get total, used and occupied space on every disk that contains a data or log file. (Note that even if enabled it won't get any data from Azure SQL Database or SQL Managed Instance). It is pointless to run this with high frequency (ie: every 10s), but it won't cause any problem.
- *Cpu* - uses the buffer ring (`sys.dm_os_ring_buffers`) to get CPU data, the table is updated once per minute. (Note that even if enabled it won't get any data from Azure SQL Database or SQL Managed Instance).

View File

@ -658,7 +658,8 @@ FROM (
OUTER APPLY sys.dm_exec_sql_text(r.[sql_handle]) AS qt
) AS data
WHERE
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
OR [open_transaction] >= 1 --Always include sessions with open transactions
OR (
[request_id] IS NOT NULL --A request must exists
AND ( --Always fetch user process (in any state), fetch system process only if active

View File

@ -522,7 +522,8 @@ FROM (
OUTER APPLY sys.dm_exec_sql_text(r.[sql_handle]) AS qt
) AS data
WHERE
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
OR [open_transaction] >= 1 --Always include sessions with open transactions
OR (
[request_id] IS NOT NULL --A request must exists
AND ( --Always fetch user process (in any state), fetch system process only if active

View File

@ -1126,7 +1126,8 @@ FROM (
OUTER APPLY sys.dm_exec_sql_text(r.[sql_handle]) AS qt
) AS data
WHERE
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
[blocking_or_blocked] > 1 --Always include blocking or blocked sessions/requests
OR [open_transaction] >= 1 --Always include sessions with open transactions
OR (
[request_id] IS NOT NULL --A request must exists
AND ( --Always fetch user process (in any state), fetch system process only if active