Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only T&Cs apply

Find out more

Release Annotations with Application Insights

.
15.6
Welcome back to this video on release annotations with App Insights. It kind of feels that we’ve covered the ability to deploy continuously. Now we need to be in a position where we can gauge what’s happening in production, right? We’ve deployed some code. We want to know what the trends are. We want to know what the diagnostics looks like. We want to know how the users are interacting with our app. But there is no end to how much data we can harness back from production. We just need the right framework, which will allow us to slice and dice the data, which will give us the ability to put that data to work, integrate with other frameworks.
47.6
And App Insights kind of ticks all the boxes there. So in this video, what we’ll do is we’ll have a quick walkthrough of how you can use the App Insights within your continuous integration, continuous delivery, and continuous deployment processes to harness some intelligence back from pretty much any environment– production, non-production, test– and then put that insight to work for you, for your product, for your product teams. Now, there is a course on EDX Library which will cover Application Insights in far more detail than I’m going to go into. So I’d encourage you to go and check it out. So let’s right get into a demo here. OK.
87.1
So what I’ve done is for the web app that we had created, I’ve set up a new App Insights resource type. And I’ve added it and configured it to work with that web app. Now, this is quite well-documented on the App Insights portal. And it’s quite well-covered in the other course that I referred to. But just to give you a feel for it if you haven’t tried App Insights yet is as your app gets utilised or invoked, then it sends this data out that App Insights can gather. And then it can surface that information into metrics that you can slice and dice for your own convenience.
123.6
Things that you can get right away without having to put any configuration in place is things like server response time, page load time, server request, fail request, time spent on a page, so and so forth. But what I’ve done in this case is I’ve customised App Insights for one specific thing. Now, in one of the previous videos, we talked about toggles, feature toggles. And so we talked– people have this tendency to put feature toggles in. But once the feature is released, they don’t really tend to go back and remove the feature toggles.
154.7
Wouldn’t it be great if we could leverage App Insights to actually figure out what toggles are still hanging out in our code base and then report that data back into App Insights so that we can then use that data, set up some alerting on it, and then action it when we need to? So just to show you how I’ve done it, if I go back into the code base, what I’ve done is in the Toggle folder where we have a lot of the toggles defined, I’ve added a logger, a reference to a logger class that I’ve created. Now, this toggle, telemetry logger class, it just gets some information back from the toggle.
194.1
So anyone who is implementing a toggle needs to implement this logger class, which will publish the name of the toggle, its type, and its current status back into the logger class. And in the logger class, I’m using the App Insights SDK that’s freely available. It’s available for all platforms and all languages, so you should definitely check it out, whether you’re doing PHP, Java, or Node, whatever. And then I’m basically capturing this data. And then I’m publishing an event back to App Insights to say, look, I’ve just got data about the logger, the toggle. And this is the information I’ve received. And I’m publishing this as an event and as a metric.
235.7
Now, if I go back into App Insights, and I go into the Metric Explorer, what you would see is I have the ability to configure how I can consume this data. So I’ve set up some charts here. And let me just click Edit to show you the chart that I’ve set up here. I’m saying, show me a bar chart by aggregation, so count. And then group this by operation name, so what page is this coming from? Because this is an MVC app, I can see this is coming from Home, Index. And then bring me back the count of toggles. Now, because I’m using toggle as a metric and as an event, I can both Group By and Aggregate on it.
278.1
So I can see here that we have about 24 calls being made to this active toggle. Now, if I scroll down further, I can see how many calls to this toggle were made in a specific session. And if I scroll down further, I’m able to see which of the toggles was called how many times. Like, the Spring Promotions toggle that I’ve set up here was called 24 times. Now, if a toggle shouldn’t be there because you have released that functionality and it’s continuing to be used here, you’re putting App Insights to work to harness that information and intelligence back from your code base.
309.4
Of course, you can go and pay for a product like LaunchDarkly or one of the other ones out there that provide the dashboard capability natively. But by being able to leverage App Insights, you are able to harness that information and put it to work for you. What’s more, you can actually drill down further and then start to create dashboards that will tell you, what are the types of targets you have? So you know the toggle classes you have. But what type are they? Are they database type? Are they always enabled, always disabled? You can kind of get that information back as well. And I’m here getting an account of the events back as well.
344
So if I’m expecting that a certain functionality has been released, and for it, the toggle should not exist anymore– and seeing this data here, I’m, like, suspicious. What’s going on? I need to go and fix it. So a lot of the times, it’s the ignorance of not having the data handy that legacy starts to come in in your code. But by leveraging the smart tools like App Insights and some of the other modern engineering platforms that we’ve talked about, you can really, really make a difference. One other thing worth highlighting here is if I go back into my release pipeline, there is an extension available called App Insights Release Annotation. You can import this extension within your release pipelines.
382.2
And every time you trigger a release, it will actually take the metadata of your release and then publish that to the App Insights ID that you specify here. Of course, you need to generate an API key. And you can do that by going into App Insights from the left Settings section, look for API Access, Generate a Key. You’ve got the application ID here. Just plug it in and run your build definition or the release definition. And that data gets published across. So I’ll quickly show you how that experience looks like. So if I go back into the App Insights here. And I launch this chart here. And let me customise the time range to the last 30 days, Update.
424.7
Now, you see this little marker here calling out that a release was done. And it tells me the number of the release and when it was done. Now, I can actually see that there was a spike in traffic after this. But even though there was a spike in traffic, the server response time has gone significantly higher, which could allude to a change that might have accidentally been shipped out in production or a new deployment that we would have done, which might have introduced some new functionality which is causing this spike. But having this marker here is a good indication that something changed.
457.7
And then if you click on it, you’ll get further details on what version of the app was shaped and a link back to the actual build and release definition. So it makes the investigation process a lot easier in that case. So with that, we are kind of at a place where we can summarise the journey that we’ve made. We went all the way from creating a simple CI build, automating that build, maturing that with release management by automating the infrastructure, the deployment, the functional testing, the performance testing, the configuration, tokenization. We took it a step further by deploying in a phased manner with group deployments. And then we took that a step further by introducing feature flags.
505.4
And then from feature flags, we looked at how we can take it even a step further and get telemetry back from production and put that intelligence to work to further enhance our project, our product. So that’s it, signing off. I hope you enjoyed the course. Do feel free to leave us feedback. Keep in contact on Twitter. Feel free to reach out if you have any questions or comments about the course.

In this course, we have covered continuous integration, continuous delivery and continuous deployment. It is time that we set ourselves up in a position where we can gauge what is happening in production.

Microsoft Visual Studio Application Insights (App Insights) is an extensible analytics service that helps you understand the performance and usage of your live web application. It’s designed for developers, to help you continuously improve the performance and usability of your app. What we’re going to explore in this learning step is Release Annotations with Application Insights (AppInsights).

Application Insights

AppInsights works with web apps on .NET or J2EE, hosted on-premises or in the cloud.

AppInsights is aimed at the development team. It can:

  • Detect, triage, and diagnose performance issues and fix them before most of your users are aware
  • Send alerts on performance changes or crashes
  • Gather metrics to help diagnose performance issues, such as response times, CPU usage, and dependency tracking
  • Perform availability tests for web apps
  • Provide exception reports and alerts
  • Provide powerful diagnostic log search (including log traces from your favourite logging frameworks).

It analyses usage patterns to understand your users better and continuously improve your app. The output provides you with:

  • Page view counts, new and returning users, geolocation, platforms, and other core usage statistics.
  • Trace usage paths to assess the success of each feature.

App Insights focuses on web apps and services. It stopped accepting new apps for mobile in April 2016 and stopped showing data in June 2016.

For more information on Application Insights, see https://azure.microsoft.com/en-us/services/application-insights/.

HockeyApp

HockeyApp is a mobile DevOps solution for building apps across platforms like iOS, Android, OS X, Microsoft Windows, Xamarin, Cordova, and Unity. It can also be applied to Windows background services and desktop apps.

  • HockeyApp creates debug symbols and groups similar crashes to help you understand their frequency and prioritise your backlog. It allows integration of crash reports with application lifecycle management (ALM) tooling to manage all of the work items in one place.

  • Helps in understanding customer behaviour to improve apps. It tracks usage through daily and monthly active customers. HockeyApp monitors crash-affected customers and measures engagement through session count.

  • Customer opinions are critical. HockeyApp can collect feedback in the app itself and channels it to development teams. Also, because the feedback is handled as discussions, it allows engagement with customers to get a deeper understanding of what they really want from apps.

  • Think of HockeyApp as an in-house app store for testing. Offer all apps in one place for beta testers and customers to install, and require customers to update to a specific version if needed. Integrate HockeyApp into a continuous build process to make uploads and distribution automatic, while ensuring that the latest version is available immediately.

  • HockeyApp scales and integrates with environments to achieve the best mobile DevOps experience. It exposes webhooks and an open API to use the toolchain to its maximum potential and adds work items to ALM tools. When using continuous integration, HockeyApp helps automate the build and distribution of mobile apps by using the HockeyApp extension for Visual Studio Team Services.

For more information on HockeyApp, see https://www.hockeyapp.net/#s.

This article is from the free online

Microsoft Future Ready: Continuous Integration Implementation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now