
-- Sample every other session or every tenth event 
-- using the divides_by_uint64 predicate

create event session EvenSessions on server
add event sqlserver.sql_statement_completed (
action (sqlserver.session_id, sqlserver.sql_text)
where package0.divides_by_uint64 (sqlserver.session_id, 2))
add target package0.ring_buffer
with (max_dispatch_latency = 1 seconds)
 
-- or if you want to see one in ten statements this might be more appropriate:
 
create event session TenthOfAllStatements on server
add event sqlserver.sql_statement_completed (
action (sqlserver.session_id, sqlserver.sql_text)
where package0.divides_by_uint64 (package0.counter, 10))
add target package0.ring_buffer
with (max_dispatch_latency = 1 seconds)
