{"id":8383,"date":"2015-03-06T04:33:37","date_gmt":"2015-03-06T04:33:37","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2015\/03\/06\/introducing-the-application-insights-sdk-for-java\/"},"modified":"2022-07-28T00:50:18","modified_gmt":"2022-07-28T08:50:18","slug":"introducing-the-application-insights-sdk-for-java","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/introducing-the-application-insights-sdk-for-java\/","title":{"rendered":"Introducing the Application Insights SDK for Java"},"content":{"rendered":"<p><font size=\"3\" face=\"Calibri\">When you publish a Java web application, you want a clear view of what users are doing with it and how it\u2019s performing. Your most effective plan for future work comes from a deep understanding of how people use what you\u2019ve already provided: which features they like, what patterns they follow, and what they find difficult. You also want to know that your application is performing well \u2013 how quickly it responds, how performance varies under load. If performance drops or exceptions are thrown, you\u2019d like to be notified quickly, and to diagnose the issue you\u2019ll want powerful filter and search facilities to investigate the event traces. <\/font><\/p>\n<p><a href=\"http:\/\/azure.microsoft.com\/services\/application-insights\" target=\"_blank\" rel=\"noopener\"><font size=\"3\" face=\"Calibri\">Visual Studio Application Insights<\/font><\/a><font size=\"3\" face=\"Calibri\"> is a service that gives you all of this, with powerful usage analytics, performance monitoring and diagnostic analysis. To use it, you add an SDK to your application, which sends telemetry to the Application Insights web portal. There, you slice and dice your metrics and events and configure the alerts you need.<\/font><\/p>\n<p><font size=\"3\" face=\"Calibri\">You can send telemetry from the server, from web pages, and from several types of client applications, such as Windows Phone and Windows Store Apps. The API is uniform across the different platforms. There\u2019s also a web test service that pings your website at regular intervals to make sure it\u2019s up and responding well.<\/font><\/p>\n<p><font size=\"3\" face=\"Calibri\">This week, at <\/font><a href=\"https:\/\/www.eclipsecon.org\/na2015\/\" target=\"_blank\" rel=\"noopener\"><font color=\"#0080c0\" size=\"3\" face=\"Calibri\">EclipseCon<\/font><\/a><font size=\"3\" face=\"Calibri\">, we\u2019re pleased to introduce the Application Insights SDK for Java. Here\u2019s a typical plan for setting up Application Insights for your Java web application. You don\u2019t have to adhere to this order: <br \/><\/font><\/p>\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <b><font size=\"3\" face=\"Calibri\">Instrumentation you add<\/font><\/b>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <b><font size=\"3\" face=\"Calibri\">Insights you get<\/font><\/b>\n        <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Server insights: Add the SDK to your Java web application<\/font>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Server-side metrics of response times, volumes of requests, numbers of users. Alerts on bad performance.<\/font>\n        <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Client insights: Add the Application Insights script to your web pages<\/font>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Page views, user and session counts, return rates and browser types.<\/font>\n        <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Availability web tests<\/font>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Chart response times, get alerts on outages.<\/font>\n        <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Add custom telemetry \u2013 client-side, server-side, or both<\/font>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Track how your application is being used by sending custom events, metrics and exceptions.<\/font>\n        <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Add the Application Insights logging appender to your logging framework<\/font>\n        <\/p>\n<\/td>\n<td valign=\"top\" width=\"390\">\n<p>\n          <font size=\"3\" face=\"Calibri\">Explore your application logs directly in the Application Insights portal with powerful slice and dice capabilities.<\/font>\n        <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4> <\/h4>\n<h4>\u00a0<\/h4>\n<h4><strong><font size=\"4\" face=\"Calibri\">What insights can I get for my Java application?<\/font><\/strong><\/h4>\n<p><font size=\"3\" face=\"Calibri\">We\u2019re constantly expanding the set of insights you can get for your java web app, to help you gain a complete 360\u00b0 view of your application\u2019s availability, performance and usage. Here\u2019s what is available today:<\/font><\/p>\n<p><font size=\"3\"><\/font><font face=\"Calibri\"><b>Monitor how your app performs<\/b> \u2013 Make sure your application is performing well, and find out quickly about any failures. This information is retrieved automatically when adding the SDK to your web project.<\/font><\/p>\n<p><img decoding=\"async\" title=\"clip_image001[4]\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image001[4]\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/1184.clip_image0014_thumb_01B04C26.png\" width=\"586\" height=\"503\" \/><\/p>\n<p>\u00a0<\/p>\n<p><font size=\"3\"><\/font><font face=\"Calibri\"><b>Analyze usage patterns in your application<\/b> \u2013 Understand adoption, interaction and engagement trends, like what pages draw most attention, what is the profile of your users, and where do they spend most of their time in your app, by inserting a JavaScript snippet in your web pages.<\/font><\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-top: 0px;border-right: 0px;border-bottom: 0px;border-left: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/5277.image_thumb_7D6DC46A.png\" width=\"582\" height=\"702\" \/><\/p>\n<p>\u00a0<\/p>\n<p><font size=\"3\"><\/font><font face=\"Calibri\"><b>Track custom event, metric and exception telemetry<\/b> \u2013 Use the telemetry API to insert a few lines of code in your application, to find out what users are doing with it, or to help diagnose issues.<\/font><\/p>\n<p><img decoding=\"async\" title=\"clip_image004[4]\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image004[4]\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/4670.clip_image0044_thumb_38B96456.png\" width=\"784\" height=\"435\" \/><\/p>\n<p>\u00a0<\/p>\n<p><font size=\"3\"><\/font><font face=\"Calibri\"><b>Explore your trace logs in the Application Insights portal<\/b> \u2013 have your trace logs sent automatically to Application Insights where you can explore and search on them, by adding the Application Insights appender to your logging framework\u2019s configuration (supported for Log4J and Logback).<\/font><\/p>\n<p><img decoding=\"async\" title=\"clip_image005[4]\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image005[4]\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/4087.clip_image0054_thumb_370DB9E4.png\" width=\"584\" height=\"689\" \/><\/p>\n<p>\u00a0<\/p>\n<p><font size=\"3\"><\/font><font face=\"Calibri\"><b>Monitor the health of your application<\/b> \u2013 After you&#8217;ve deployed your web application, you can set up web tests to monitor its availability and responsiveness. Application Insights will send web requests at regular intervals from points around the world, and can alert you if your application responds slowly or not at all.<\/font><\/p>\n<p><img decoding=\"async\" title=\"clip_image007[4]\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image007[4]\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/1680.clip_image0074_thumb_084D22A4.jpg\" width=\"670\" height=\"312\" \/><\/p>\n<h4> <\/h4>\n<h4>\u00a0<\/h4>\n<h4><strong><font size=\"4\" face=\"Calibri\">Adding the Application Insights SDK for Java to your project<\/font><\/strong><\/h4>\n<p><font size=\"3\" face=\"Calibri\">If you develop your project using Eclipse, adding the Application Insights Java SDK to your dynamic web project is easy. All you need to do is install the newest version of the <\/font><a href=\"http:\/\/marketplace.eclipse.org\/content\/azure-toolkit-eclipse\" target=\"_blank\" rel=\"noopener\"><font color=\"#0080c0\" size=\"3\" face=\"Calibri\">Azure Toolkit for Eclipse<\/font><\/a><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#669966\"> <\/font>(By Microsoft Open Technologies) which will be available during the week of EclipseCon, right-click your project, select \u201cConfigure Application Insights\u201d, and provide your instrumentation key. <a href=\"http:\/\/azure.microsoft.com\/documentation\/articles\/app-insights-java-eclipse\/\" target=\"_blank\" rel=\"noopener\"><font color=\"#0080c0\" size=\"3\" face=\"Calibri\">Step by step guide on how to do this<\/font><\/a><font size=\"3\" face=\"Calibri\">.<\/font><\/p>\n<p><img decoding=\"async\" title=\"clip_image008[4]\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image008[4]\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2015\/03\/7737.clip_image0084_thumb_195671E9.png\" width=\"800\" height=\"600\" \/><\/p>\n<p><font size=\"3\" face=\"Calibri\">There are a number of additional ways to add the SDK to your project: using Maven, Gradle, or manually. <\/font><a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=524037\" target=\"_blank\" rel=\"noopener\"><font color=\"#0080c0\" size=\"3\" face=\"Calibri\">This article<\/font><\/a><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#669966\"> <\/font>covers all these options in detail.<\/p>\n<h4>\u00a0<\/h4>\n<h4><font size=\"4\" face=\"Calibri\"><strong>Can I use Visual Studio Online to plan, code, build, test and deploy my Java applications?<\/strong><\/font><\/h4>\n<p><font size=\"3\" face=\"Calibri\">Absolutely, <\/font><a href=\"https:\/\/www.visualstudio.com\/features\/java-vs\" target=\"_blank\" rel=\"noopener\"><font color=\"#0080c0\" size=\"3\" face=\"Calibri\">Visual Studio Online provides cloud-hosted tools for your Java teams<\/font><\/a><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#0080ff\"> <\/font>that complement your favorite Java tools and services such as Eclipse and Jenkins, respectively.<\/p>\n<p>\u00a0<\/p>\n<h4><strong><font size=\"4\" face=\"Calibri\">What\u2019s next?<\/font><\/strong><\/h4>\n<p><font size=\"3\" face=\"Calibri\">Now that you\u2019ve added the SDK to your project, you can go ahead and add more instrumentation to gain a variety of insights about your Java application.<\/font><\/p>\n<p><font size=\"3\" face=\"Calibri\">Here are some links to get you started:<\/font><\/p>\n<p><font color=\"#0080c0\" size=\"3\" face=\"Calibri\"><a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-insights-web-track-usage\/\" target=\"_blank\" rel=\"noopener\">Track usage of web applications<\/a><\/font><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#0080c0\"> <\/font>\u2013 add a script to your web pages to track page views, users and sessions<\/p>\n<p><font color=\"#0080c0\" size=\"3\" face=\"Calibri\"><a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-insights-java-trace-logs\/\" target=\"_blank\" rel=\"noopener\">Explore Java trace logs in Application Insights<\/a><\/font><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#0080c0\"> <\/font>\u2013 capture logs from your favorite logging framework so you can slice and dice along with request and page view events<\/p>\n<p><font color=\"#0080c0\" size=\"3\" face=\"Calibri\"><a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-insights-web-track-usage-custom-events-metrics\/\" target=\"_blank\" rel=\"noopener\">Write custom telemetry with Application Insights API<\/a><\/font><font size=\"3\" face=\"Calibri\"><\/font><font color=\"#0080c0\"> <\/font>\u2013 track what people do with your application<\/p>\n<p><font color=\"#0080c0\" size=\"3\" face=\"Calibri\"><a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-insights-monitor-web-app-availability\/\" target=\"_blank\" rel=\"noopener\">Monitor any web site&#8217;s availability and responsiveness<\/a><\/font><font size=\"3\"><\/font><font face=\"Calibri\"><\/font><font color=\"#0080c0\"> <\/font>\u2013 set up web tests<\/p>\n<p><font color=\"#0080c0\"><a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-insights-java-track-http-requests\/\" target=\"_blank\" rel=\"noopener\"><font size=\"3\" face=\"Calibri\">Track HTTP requests in a Java web application<\/font><\/a><\/font><font size=\"3\" face=\"Calibri\"> \u2013 <\/font><font color=\"#000000\">view information about the HTTP requests sent to your application<\/font><\/p>\n<h4>\u00a0<\/h4>\n<h4><strong><font size=\"4\" face=\"Calibri\">What do you think?<\/font><\/strong><\/h4>\n<p><font size=\"3\" face=\"Calibri\">We&#8217;d love to get your feedback. How can we make this better? Please let us know!<\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you publish a Java web application, you want a clear view of what users are doing with it and how it\u2019s performing. Your most effective plan for future work comes from a deep understanding of how people use what you\u2019ve already provided: which features they like, what patterns they follow, and what they find [&hellip;]<\/p>\n","protected":false},"author":163,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[224,1],"tags":[],"class_list":["post-8383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-devops"],"acf":[],"blog_post_summary":"<p>When you publish a Java web application, you want a clear view of what users are doing with it and how it\u2019s performing. Your most effective plan for future work comes from a deep understanding of how people use what you\u2019ve already provided: which features they like, what patterns they follow, and what they find [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8383","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\/163"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=8383"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/8383\/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=8383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=8383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=8383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}