For some optimization work that we are doing, I will like to know the name of the Extended Events’ Engine currently targeted file.
As always we know that Microsoft exposes a lot of metadata via Dynamic Management Views.
The specific ones that we will use are:
- Currently executing Extended Event Sessions
- Targets for currently executing sessions
SELECT [extendedEvent] = tblXES.[name] , [executionCount] = tblXEST.execution_count , [executionDuration] = tblXEST.execution_duration_ms , [targetData] = tblXEST.target_data , [fileCurrent] = cast(tblXEST.target_data as xml).value('(//File/@name)','nvarchar(255)') FROM sys.dm_xe_sessions AS tblXES INNER JOIN sys.dm_xe_session_targets AS tblXEST ON tblXES.[address] = tblXEST.[event_session_address] where ( ( tblXEST.target_name = 'event_file' ) )