Log to Azure Application Insights

Introduction

You can configure Identify to log to Azure Application Insights and use its rich monitoring capacity to monitor many of Identify's activities.

Enable Application Insights

To log data to Application Insights, you need to do the following steps:

  • Create and set up your Application Insights account.
  • Copy its Instrumentation Key setting.

logging-application-insights

  • Enable the Log target setting for Application Insights:

logging-application-insights

  • Save your changes.

Monitoring

Application Insights has some built-in queries that are very useful for learning how it works. Upcoming sections explain how to set up a dashboard and what each metric does. You can in fact use the Identify dashboard - Identify specific metrics - template.json to create a dashboard.

logging-application-insights

Response time (latency)

When it comes to performance, the most important activities to measure in Identify are throughput and latency.

When pushing Identify’s logs to Application Insights using Serilog, data is stored in the traces collection:

logging-application-insights

Query to monitor average response time

logging-application-insights

Query to monitor response bucket

Pie chart (good for showing percentages)

If you want to have 99% of all logins done in less than 1 second, approximately 99% of all requests must be in the 250ms bucket because a typical login needs 4 web requests.

logging-application-insights

Bar chart (good for showing total numbers)

logging-application-insights

Failed requests

Query to count total failed requests

logging-application-insights

Query to find all exceptions causing request failures

Monitoring some specific errors (context id)

Query to count total failed requests every 30 minutes that relate to context id: