{"id":4303,"date":"2012-09-30T23:18:29","date_gmt":"2012-09-30T23:18:29","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/09\/30\/getting-started-with-preemptive-analytics-for-team-foundation-server\/"},"modified":"2022-07-22T01:32:40","modified_gmt":"2022-07-22T09:32:40","slug":"getting-started-with-preemptive-analytics-for-team-foundation-server","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/getting-started-with-preemptive-analytics-for-team-foundation-server\/","title":{"rendered":"Getting Started with PreEmptive Analytics for Team Foundation Server"},"content":{"rendered":"<p>Chris Kinsman wrote a great article on where to use PreEmptive Analytics for Team Foundation Server with best practices, implementation considerations etc etc for <a href=\"http:\/\/msdn.microsoft.com\/en-us\/magazine\/jj656636.aspx\">MSDN Magazine<\/a>.\u00a0<\/p>\n<p>The best part i found of this article was the tutorial on getting started.\u00a0 In talking to Chris i mentioned i would love to have a quick and dirty \u201cprimer\u201d on the ALM Blog.\u00a0<\/p>\n<p>Hope you enjoy it!<\/p>\n<p>(Thanks Chris!)<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>&#42;************************<\/p>\n<p>An important new tool inside Visual Studio and TFS 2012 allows you to capture all the information about issues in your applications across clients and services\u2014and quickly respond to them by having all the information accessible to the team. Called PreEmptive Analytics for Team Foundation Server (PA for TFS), this integrated component in TFS 2012 helps teams identify the most important and widespread issues in deployed applications before users even report them. While there are several ways to get PreEmptive Analytics setup one of the easiest ways to get PA for TFS running would be.<\/p>\n<p><strong>Step 1. Install PA for TFS<\/strong><\/p>\n<p>The first step is to install PA for TFS. A SQL Server instance is required to store the data. To test this inside a firewall, install the Combined Exception Endpoint and Exception Aggregator role. Point it at the TFS server and specify a TFS account that can create and edit work items. This will install the Exception Endpoint and Exception Aggregator services and create a database to persist the exception data. When the installer is done, it will give you the URL for the Exception Endpoint service. Save this for use later, when configuring your application instrumentation.<\/p>\n<p><strong>Step 2. Install Team Explorer Extensions<\/strong><\/p>\n<p>The installer automatically launches the PreEmptive Analytics administration console. Use this console to configure the connection to the TFS server and provision Team Projects with the PA for TFS extensions.\u00a0 This will add the PreEmptive Analytics node under the Team Project in Team Explorer.<\/p>\n<p>\u00a0<\/p>\n<p><strong>Step 3 Instrument Your Application<\/strong><\/p>\n<p>Add, five attributes: ApplicationAttribute, BusinessAttribute, ExceptionTrackAttribute, SetupAttribute and TearDownAttribute to your application.\u00a0 The ApplicationAttribute, shown in <strong>Figure 1<\/strong>, is placed at the assembly level and identifies the specific application you\u2019ll be tracking. It\u2019s keyed with a GUID and includes the Name and Version. Using the GUID Generator that comes with Visual Studio, generate a GUID in Registry Format and then strip off the curly braces after pasting it into the attribute. Keep record of this GUID, as it will be needed it later when configuring the aggregator.<\/p>\n<p><img decoding=\"async\" title=\"clip_image001\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/8420.clip_image001_thumb_17FDA26C.jpg\" width=\"244\" height=\"169\" \/><\/p>\n<p><em>Figure 1 The ApplicationAttribute Identifies the Application Being Tracked<\/em><br \/>\nThe BusinessAttribute, shown in <strong>Figure 2<\/strong>, is also placed at the assembly level and keys the application to the company. Generate the GUID again using the GUID Generator and make sure to note it for later use when configuring the aggregator.<\/p>\n<p><img decoding=\"async\" title=\"clip_image002\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/1057.clip_image002_thumb_0233BA0F.jpg\" width=\"244\" height=\"169\" \/><br \/>\n<em>Figure 2 The BusinessAttribute Identifies the Company<\/em><\/p>\n<p>**<br \/>\nThe SetupAttribute, shown in <strong>Figure 3<\/strong>, is placed on the application entry point and sets up the collection and reporting of data by PA for TFS. It specifies the Exception Endpoint that should be contacted to report the data. Fill in the value from the end of the Exception Aggregator setup. It will likely also be necessary to scroll down to the bottom of the Attribute Properties grid and set UseSSL to False if a certificate isn\u2019t installed. It\u2019s also possible to drill into the App class and place the SetupAttribute into Main, as shown in <strong>Figure 3<\/strong>.<\/p>\n<p><img decoding=\"async\" title=\"clip_image003\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/3630.clip_image003_thumb_2FB4D9D2.jpg\" width=\"244\" height=\"169\" \/><br \/>\n<em>Figure 3 Placing the SetupAttribute into Main<\/em><br \/>\nThe TeardownAttribute, shown in <strong>Figure 4<\/strong>, is placed on the application exit point and wraps up the collection of data, flushes buffers and ensures that PA for TFS has shut down cleanly as the application exits. As with the SetupAttribute, it\u2019s possible to place the TeardownAttribute into the Main method, and <strong>Figure 4<\/strong> illustrates this.<\/p>\n<p><img decoding=\"async\" title=\"clip_image004\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/1882.clip_image004_thumb_080E5DA8.jpg\" width=\"244\" height=\"175\" \/><br \/>\n<em>Figure 4 Placing the TeardownAttribute into Main<\/em><br \/>\nThe final attribute, ExceptionTrackAttribute, shown in <strong>Figure 12<\/strong>, can be placed anywhere to track exceptions in the application. In this case, to handle all uncaught exceptions, the attribute is placed at the assembly level and configured to report all unhandled exceptions. To collect comments and contact information from the end user, you can optionally set ReportInfoSourceElement to DefaultAction. This will provide a default UI to collect this data.<\/p>\n<p><img decoding=\"async\" title=\"clip_image005\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image005\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/7750.clip_image005_thumb_54D2243E.jpg\" width=\"244\" height=\"169\" \/><br \/>\n<em>Figure 4 Placing the ExceptionTrackAttribute into the Application<\/em><\/p>\n<p><strong>Step 4 Build a new version of the executable<\/strong>.\u00a0 Once all the attributes have been applied, Dotfuscator is used to build a new version of the executable. This build process can be automated and done as part of a TFS build once you\u2019ve done the initial configuration.<\/p>\n<p><strong>Step 5 Configure the Aggregator<\/strong>.\u00a0 Start the Aggregator Administrator Console and add the TFS Instance and Team Project collection. Select the Team Project being used and click the Apply action next to it in the grid. <strong>Figure 5<\/strong> illustrates application of the Team Project extensions to a project called Agile.<\/p>\n<p><img decoding=\"async\" title=\"clip_image006\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/09\/1563.clip_image006_thumb_183A25A1.jpg\" width=\"244\" height=\"159\" \/><br \/>\n<em>Figure 5 Placing Team Project Attributes into the Project<\/em><br \/>\nThe default Exception Sets are fine to start with, so we\u2019ll move on to the Subscriptions. Add a subscription for the application and give it a name. This example is simply called WpfApplicationV1. Fill in the Company ID and Application ID GUIDs noted when instrumenting the application. Bind it to the TFS and Team Project added previously. Optionally select an area path from the Team Project. The default rule should be fine\u2014just be sure to change the threshold from 80 to a value appropriate for your needs. Close the console and select Save when prompted.<\/p>\n<p><strong>Step 6 Deploy Your Application<\/strong> You\u2019re done, and the team can now deploy the application. Make sure to grab the instrumented version that Dotfuscator created in the Dotfuscator directory when it\u2019s deployed.<\/p>\n<hr \/>\n<p>**Summary: **<\/p>\n<p>Now that the application is running out in the wild you can now simply create a query new for Incident type work items and let your mind rest a little easier knowing you are now watching your production applications day and night!\u00a0 PreEmptive Analytics makes TFS even more compelling by making production issues immediately actionable as work items shorten the mean-time-to-repair. See this link for Chris\u2019s <a href=\"http:\/\/msdn.microsoft.com\/en-us\/magazine\/jj656636.aspx\">full article at MSDN on PreEmptive Analytics<\/a>.\u00a0<\/p>\n<p>Of course make sure and check out the great MSDN documentation:<\/p>\n<ul>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd551417.aspx\">PreEmptive Dotfuscator and Analytics CE<\/a><\/li>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh973124.aspx\">PreEmptive Analytics for TFS<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Chris Kinsman wrote a great article on where to use PreEmptive Analytics for Team Foundation Server with best practices, implementation considerations etc etc for MSDN Magazine.\u00a0 The best part i found of this article was the tutorial on getting started.\u00a0 In talking to Chris i mentioned i would love to have a quick and dirty [&hellip;]<\/p>\n","protected":false},"author":81,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"acf":[],"blog_post_summary":"<p>Chris Kinsman wrote a great article on where to use PreEmptive Analytics for Team Foundation Server with best practices, implementation considerations etc etc for MSDN Magazine.\u00a0 The best part i found of this article was the tutorial on getting started.\u00a0 In talking to Chris i mentioned i would love to have a quick and dirty [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/4303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=4303"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/4303\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=4303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=4303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=4303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}