Targets
Targets
are event session consumers and indicate where output is located, such
as a file, ring buffer, or a bucket with aggregation. Targets can
process events synchronously or asynchronously. Extended Events provides
several predefined targets you can use as appropriate for directing
event output.
You can find a list of available targets in SQL Server 2008 by running the following query:
select * from sys.dm_xe_objects where object_type ='target'
Predicates
Predicates are a set
of logical evaluation rules for events when they are processed that
serve to filter events. They help reduce the volume of captured data and
tailor down the output for analysis. In effect, they enable the
Extended Events user to selectively capture event data based on specific
criteria.
There are two different types of predicates in SQL Server 2008: pred_compare and pred_source. The pred_compare predicates are comparison functions, such as >=.
To view a list of the pred_compare predicates available in SQL Server 2008, you can run the following query:
select * from sys.dm_xe_objects where object_type = 'pred_compare'
If you run this query, you’ll notice that there are a number of similar pred_compare predicates with the same comparison function but for different data types (for example, greater_than_int64 and greater_than_float64).
The pred_source predicates are extended
attributes that can be used within predicates to filter on attributes
not carried by the event’s own schema (such as transaction_id or database_id). The available pred_source predicates can be listed by using the following query:
select * from sys.dm_xe_objects where object_type = 'pred_source'
Actions
Actions are
programmatic responses or series of responses to an event. Actions are
bound to an event, and each event may have a unique set of actions.
Actions are performed synchronously in association with bound events.
They can be used to accomplish certain tasks or simply provide more
information relevant to the events.
There are many types of actions, and they have a wide range of capabilities:
Receive a stack dump and inspect data.
Store state information in a variable.
Bring event data from multiple places together.
Append new data to existing event data.
To view a list of the actions available in SQL Server 2008, you can run the following query:
select * from sys.dm_xe_objects where object_type = 'action'
Types and Maps
Two kinds of data types can be defined in an event: scalar types and maps. Scalar types are single values, like integers. Maps
are tables that map internal object values to static, predefined,
user-friendly descriptions. They help you see what the internal values
stand for (making them human consumable) but allow the event to more
efficiently store the integer map value rather than the actual text.
Like all the other elements discussed thus far, types and maps can also be viewed by querying the sys.dm_xe_objects catalog view:
select * from sys.dm_xe_objects
where object_type in ('type', 'map')
Although types are relatively self-explanatory, maps
require a lookup to expose the associated human-readable text when
appropriate. The map values are stored in the DMV called sys.dm_xe_map_values. To list the map_keys and map_values for lock types, for example, you can run the following query:
select * from sys.dm_xe_map_values where name = 'lock_mode'
Extended Events Catalog Views and DMVs
To get metadata information about what events,
actions, fields, and targets have been defined, you can use the catalog
views supplied with SQL Server.
For catalog views, the following short list shows the SELECT statements and their purposes (that use the predefined SSEE catalog views).
To see event sessions, you use the following:
SELECT * FROM sys.server_event_sessions;
To see actions on each event (of an event session), run this:
SELECT * FROM sys.server_event_session_actions;
To see events in an event session, run the following:
SELECT * FROM sys.server_event_session_events;
To see columns of events and targets, use this statement:
SELECT * FROM sys.server_event_session_fields;
And, to see event targets for an event session, you use the following:
SELECT * FROM sys.server_event_session_targets;
You use the dynamic management views to obtain
session metadata and session data itself (as it is being gathered during
execution). The metadata is obtained from the catalog views, and the
session data is created when you start and run an event session.
To see session dispatcher pools, you use the following statement:
SELECT * FROM sys.dm_os_dispatcher_pools;
To see event package objects, use this:
SELECT * FROM sys.dm_xe_objects;
To see the schema for all objects, run this statement:
SELECT * FROM sys.dm_xe_object_columns;
To see the registered packages in the Extended Events engine, use this:
SELECT * FROM sys.dm_xe_packages;
To see the active Extended Events sessions, run the following:
SELECT * FROM sys.dm_xe_sessions;
To see session targets, run this statement:
SELECT * FROM sys.dm_xe_session_targets;
To see session events, use this:
SELECT * FROM sys.dm_xe_session_events;
To see event session actions, use this:
SELECT * FROM sys.dm_xe_session_event_actions;
To see the mapping of internal keys to readable text, use the following:
SELECT * FROM sys.dm_xe_map_values;
Specific variations might be as follows:
SELECT map_value Keyword from sys.dm_xe_map_values
where name = 'keyword_map';
SELECT map_key, map_value from sys.dm_xe_map_values
where name = 'lock_mode';
And finally, to see the configuration values for objects bound to a session, you use the following:
SELECT * FROM sys.dm_xe_session_object_columns;