{"id":774,"date":"2007-08-20T22:07:00","date_gmt":"2007-08-20T22:07:00","guid":{"rendered":"\/blogs\/bobb\/post\/Finishing-XEvent-package-items-syntax-and-semantics-(moon-turn-the-tides).aspx"},"modified":"2007-08-20T22:07:00","modified_gmt":"2007-08-20T22:07:00","slug":"finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/","title":{"rendered":"Finishing XEvent package items, syntax, and semantics (moon turn the tides&#8230;)"},"content":{"rendered":"<p>\nThis won&#39;t be as long of an entry because I&#39;m trying to finish describing the items that you can use in an XEvent session, that is, the items that exist in a package.<br \/>\n&nbsp; Events<br \/>\n&nbsp; Targets<br \/>\n&nbsp; Actions<br \/>\n&nbsp; Predicates<br \/>\n&nbsp; Maps<br \/>\n&nbsp; Types<br \/>\n&nbsp;<br \/>\nLet&#39;s do <strong>types<\/strong> and <strong>maps<\/strong>. A type is simply a data type, a simple type like Int16 or complex type like &#39;SOS_context&#39;. Almost all the types live in package0, there&#39;s only one each in sqlos and sqlserver packages. Maps are enumerated constants.\n<\/p>\n<p>\nSee types:<br \/>\nselect * from sys.dm_xe_objects where object_type = &#39;type&#39;\n<\/p>\n<p>\nand map:<br \/>\nselect * from sys.dm_xe_objects where object_type = &#39;map&#39;\n<\/p>\n<p>\nand legal enumeration (map_key) values:<br \/>\nselect map_value, map_key from sys.dm_xe_map_values where name = &#39;keyword_map&#39;\n<\/p>\n<p>\n<strong>Predicates<\/strong>: for predicates (think filters in SQL Profiler), you need a predicate source and a predicate comparator.<br \/>\nselect * from sys.dm_xe_objects where object_type like &#39;pred%&#39; order by object_type\n<\/p>\n<p>\nThere&#39;s probably more to it than this, there are customizable event attributes that can be SET in ADD EVENT, and predicates can use event fields for filtering (but not actions). But this will get you started.\n<\/p>\n<p>\nOne last thing that bears mentioning is the <strong>pair_matching target<\/strong>. This target allows you to specify a pair of events (like lock_acquired, lock_released) and after you&#39;ve run the workload a while, it will show you (the relevent fields in the XML structure exposed by target_data (as in, SELECT CAST(target_data as xml) FROM sys.dm_xe_session_targets;) those events that do not match. That is, the locks that have been acquired but not yet released. VERY cool.\n<\/p>\n<p>\nOnce again BOL shows an example that takes advantage of knowledge of the pair_matching target&#39;s XML data structure. The XML used for target_data appear to be schema-less, i.e. they don&#39;t go by a named XML schema, i.e. you have to know what the structure items (elements, attributes, and values) mean. BTW, I keep referring to the BOL because I very much&nbsp;like the info in the BOL, as far as it goes, especially at this early stage. I come to (hopefully)&nbsp;elucidate and expound upon the BOL, not to&nbsp;complain about&nbsp;it. THANKS Buck, Alan, Steve, and all&#8230;\n<\/p>\n<p>\nYou can specify begin and end events, begin and end matching_columns and matching_actions. This is from:\n<\/p>\n<p>\nSELECT * FROM sys.dm_xe_object_columns<br \/>\nWHERE column_type = &#39;customizable&#39;<br \/>\nWHERE object_name = &#39;pair_matching&#39;\n<\/p>\n<p>\nHope this was useful. Happy event tracing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This won&#39;t be as long of an entry because I&#39;m trying to finish describing the items that you can use in an XEvent session, that is, the items that exist in a package. &nbsp; Events &nbsp; Targets &nbsp; Actions &nbsp; Predicates &nbsp; Maps &nbsp; Types &nbsp; Let&#39;s do types and maps. A type is simply [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,29],"tags":[],"class_list":["post-774","post","type-post","status-publish","format-standard","hentry","category-extended-events","category-sql-server-2008"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"This won&#039;t be as long of an entry because I&#039;m trying to finish describing the items that you can use in an XEvent session, that is, the items that exist in a package. &nbsp; Events &nbsp; Targets &nbsp; Actions &nbsp; Predicates &nbsp; Maps &nbsp; Types &nbsp; Let&#039;s do types and maps. A type is simply [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2007-08-20T22:07:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/\",\"name\":\"Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2007-08-20T22:07:00+00:00\",\"dateModified\":\"2007-08-20T22:07:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extended Events\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/extended-events\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Finishing XEvent package items, syntax, and semantics (moon turn the tides&#8230;)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/","og_locale":"en_US","og_type":"article","og_title":"Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin","og_description":"This won&#39;t be as long of an entry because I&#39;m trying to finish describing the items that you can use in an XEvent session, that is, the items that exist in a package. &nbsp; Events &nbsp; Targets &nbsp; Actions &nbsp; Predicates &nbsp; Maps &nbsp; Types &nbsp; Let&#39;s do types and maps. A type is simply [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/","og_site_name":"Bob Beauchemin","article_published_time":"2007-08-20T22:07:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/","name":"Finishing XEvent package items, syntax, and semantics (moon turn the tides...) - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2007-08-20T22:07:00+00:00","dateModified":"2007-08-20T22:07:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/finishing-xevent-package-items-syntax-and-semantics-moon-turn-the-tides\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Extended Events","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/extended-events\/"},{"@type":"ListItem","position":3,"name":"Finishing XEvent package items, syntax, and semantics (moon turn the tides&#8230;)"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}