Azure Application Insights Best Practices
In this post, Premier Developer consultant Adel Ghabboun outlines some best practices when using Application Insights.
Here are some Azure Application Insights best practices you should consider when monitoring your application:
- It is always recommended to create multiple Application Insights resources to split telemetry for different environments, but do we have to? The answer is, it depends
- You can use a single resource, and use custom dimensions to tag the data source
- Or create multiple Application Insights resources, to split the telemetry into dev/test/prod, back-end/front-end, etc. With this option you get
- Better separation of telemetry, alerts, work items configuration, permissions (RBAC)
- Spread Limits such as web test count, throttling, data allowance.
- You can do cross-resource queries
- Often, we ask if we need Status Monitor tool when your app is instrumented with the SDK. It depends on which version of .NET is being used.
- If you use .NET 4.5, no dependencies are collected with the SDK, so the Status Monitor is needed here to collect detailed dependency info.
- If you use .NET 4.6, SDK collects basic info about outbound HTTP and SQL calls (Note, for more detailed dependency info, you need Status Monitor tool)
- Set a capping limit for your dev/test environment, NOT for your prod environment, otherwise you end up losing data once you reach the limit.
- Microsoft recommends using HockeyApp for monitoring Windows desktop apps (WinForms, WPF, Console). Although telemetry can be sent to Application Insights from a desktop application using the following steps:
- Create Application Insights resource in the Portal
- Add the Microsoft.ApplicationInsights.WindowsServer NuGet
- Update the instrumentation Key
- Instantiate a TelemtryClient in your app
- Use the API to send custom telemetry
- More info is found here
- In case you can’t see your data such as dependencies, perf counters, it is always a good practice to
- Check your firewall practice
- Check the iKey is configured properly
- Make sure the user account under which IIS is running has privileges to access the internet
- Make sure you are calling the Flush method periodically.
- Don’t configure alerts you have no need for. You might end up receiving hundreds of daily email notifications you don’t need, and lose track of urgent ones.
- Always think Security and set up your Application Insights resource permissions via RBAC to specify who can see your data.