By now you should have a good
understanding of Extended Events terminology, how it works, and its
features. Space doesn’t permit covering every internal detail,
capability, or feature, but you should be able to start deploying your
own sessions through SQL Server Management Studio based on the examples
shown here.
This section uses the new capabilities of SQL
Server 2012’s Management Studio to create Extended Events sessions. If
you’re interested in using the T-SQL commands, you’ll also see how the
SSMS interface can help you get started using the T-SQL commands.
Introduction to the New Session Form
SQL Server Management Studio provides
two ways to create a new session: a New Session Wizard and a New
Session creation form, as shown in Figure 1.
While the wizard option may appeal to newcomers
as an easy way to get started, it’s a little too lightweight in terms
of functionality to be of great use, and using the more thorough New
Session creation form, shown in Figure 2, isn’t much more complicated. We recommend ignoring the wizard when you begin creating your own sessions.
In addition to naming your session, such as Deadlock_Detection, it has the following three options (highlighted with boxes in the figure):
- Templates are pre-configured sessions — that is, almost
ready-to-use sessions that you can deploy for common and generic
situations. After selecting a template, you can configure some of the
options specific to your environment, such as the event file target
paths.
- The schedule options are self-explanatory. You can define them when
you create the session or come back and configure them later.
- Causality Tracking is an option you might select in more
complicated sessions for which you want to be able to correlate
multiple events that were executed by multiple running tasks. This
would rarely be required for the types of sessions you’ll be creating
here, so it can be ignored for now.
The Events pane, shown in Figure 3, is where you configure the events for which you want your session to collect data, for example, lock_deadlock.
It is best explored using the scrollbar shown in the boxed area,
although you can perform text searches as well. When you have found the
events you want, you can add and remove them with the arrow buttons.
Once events have been added, as shown in Figure 4,
the second half of the Events pane becomes active and you’re able to
click the Configure button. This reveals several tabs where additional
session options can be selected, as shown in Figure 5.
Actions, also known as global fields, can be chosen; and filters, also
known as predicates, can be defined, after which you can select any
optional fields that the event makes available for collection.
The form’s Data Storage page, shown in Figure 6
with the drop-down list of available targets expanded, is where the
session’s targets are defined. A session can have multiple targets —
for example, an event file and an event counter — and here is where you
configure them. As you’ll see later, the histogram targets have their
own additional configuration options that become available when you add
either of them.
Finally, you can figure some advanced session
options, such as Event Retention Mode and Max Memory Size, from the
Advanced pane, shown in Figure 7.