How to integrate HockeyApp with Application Insights
Starting from HockeySDK 4.1.1 we introduced integration with Application Insights. Now, having just single HockeySDK in your mobile application you can use features from both powerful products - HockeyApp and Application Insights, where HockeyApp is the leader on Windows Platform for Crash Reporting, Beta Distribution and Application Insights provides a rich experience for custom telemetry reporting.
This document contains the following sections:
- On-boarding to Application Insights
- Application Insights API
- Application Insights SDK Migration
Please note that Application Insights will cause additional costs on your Azure subscription, separate to HockeyApp. For details, please refer to the Application Insights pricing page. Also note that we highly recommend against buying the Enterprise tier as the node-based pricing is not suitable for mobile or desktop apps!
HockeyApp for Windows provides six Application Insights APIs, which we will describe in detail below.
HockeyApp provides in an event tracking feature. With Application Insights integration, you can add custom properties with custom values to any event you track.
Microsoft.HockeyApp.HockeyClient.Current.TrackEvent(name, properties = null, metrics = null)
TrackMetric API allows to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.
Microsoft.HockeyApp.HockeyClient.Current.TrackMetric(name, value, properties = null)
Use this to help diagnose problems by sending a 'breadcrumb trail' to Application Insights.
Microsoft.HockeyApp.HockeyClient.Current.TrackTrace(string message, severityLevel)
In a your mobile application you might want to track a "page" whenever the user opens a pivot or a page in the application. User and session data is sent as properties along with page views, so the user and session charts come alive when there is page view telemetry.
Use this api to log the duration and frequency of calls to external components on which your app depends, like HTTP calls or SQL calls.
Microsoft.HockeyApp.HockeyClient.Current.TrackDependency( dependencyName, commandName, startTime, duration, success);
Normally the SDK sends data at times chosen to minimize impact on the user. However, in some cases you might want to flush the buffer - for example, if you are using the SDK in an application that shuts down. Please note, that the function is is synchronous and you need to invoke it only in case there is a real need in it.
If you are using the old Application Insights SDK for Windows, you have three options:
Migrate to HockeySDK, either with your old instrumentation key from Application Insights or the App ID from HockeyApp (see below). This is the recommended option and you will benefit from future features. This is also the only option that enables support for .NET Native crash reporting.
Keep using the Application Insights SDK, either with your old instrumentation key from Application Insights or the App ID from HockeyApp (see below). Please note that we no longer provide updates or bugfixes for the Application Insights SDK. Any support request will be mitigated by migration to HockeySDK.
Review the source code of the Application Insights Core SDK and write you own wrapper for its API. This option is fully at your own risk and we are not able to provide help with this.
Both HockeySDK and Application Insights SDK send the same data format (called "Common Schema") to the same API endpoint, so you can use either SDK under the mentioned constraints. Both SDKs also use the same database for instrumentation keys or App IDs, with the following difference:
HockeySDK expects the App ID to be formatted as a 40-char hex string with no dashes, for example:
Application Insights SDK expects the instrumentation key formatted as a GUID, so the above example needs to be converted to:
We do not recommend to use both SDKs in the same app, i.e. you need to chose one.