Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect Errors & Warnings Using Extended Event #161

Open
jacobgexigo opened this issue Apr 22, 2022 · 1 comment
Open

Collect Errors & Warnings Using Extended Event #161

jacobgexigo opened this issue Apr 22, 2022 · 1 comment

Comments

@jacobgexigo
Copy link

I was thinking it would be nice to capture errors and warnings using an extended event like you do with the slow queries. Typically if someone tells me their app is timing out or something I will setup a session on the "Error Reported" event and filter out the every day warnings (5701, 5703, 8153, etc.). This would allow us gather things like malformed queries being executed, timeouts on connection, etc. and use that to work with the development teams. I think there would have to be something in the configuration side that we would use to filter out the error numbers we don't care about so that it's not taking up more storage than necessary.

CREATE EVENT SESSION [DBADash_Errors] ON SERVER
ADD EVENT sqlserver.error_reported( ACTION(package0.last_error,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.is_system,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.session_id,sqlserver.sql_text,sqlserver.username)
WHERE ([error_number]<>(5701) AND [error_number]<>(5703) AND [error_number]<>(8153)))
ADD TARGET package0.ring_buffer
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=2 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO

@DavidWiseman
Copy link
Collaborator

I've thought about doing more stuff with extended events. It might also be useful to capture deadlocks #67 for example. Like deadlocks, error_reported is also captured via the system_health session - so pulling it from there could be an option. Or it might still make sense to have a custom session for it.
It's something I'll think about and might implement at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants