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
- 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)
- 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
- 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.