3

Does anyone know why the 'Average response time' metric in Azure monitor doesn't always match up to the Application Insights response time?

It it because of sampling?

For example, here's some stats i pulled from my Azure App Service: enter image description here

..and the corresponding stats in AppInsights: enter image description here

So the bumps are there.. but the difference is huge.

Is there a difference? If so, what are they? I haven't been able to find documentation anywhere.

Thanks.

RPM1984
  • 72,246
  • 58
  • 225
  • 350
  • I assume those metrics are calculated differently. Application Insights is within the application process and it knows how much time did the request execution take from the moment it hit managed code within IIS web server or within self-hosted server. App Service metric on the other hand may take into account the time spent by request in routing/queuing through that web server implementation, it may as well include some networking into the consideration if calculated before request hits the load balancer. With that, App Service metric can clearly have significantly higher values. – Dmitry Matveev Apr 26 '19 at 00:15
  • @DmitryMatveev yep - but i want to understand what each value means. I don't want to make assumptions. – RPM1984 Apr 26 '19 at 00:32
  • Application Insights duration - this is how much time request spent within app's code base. Cannot comment about response time but my guess would be this is how much time request spent within infra (web app). I can see overhead not only in spikes but everywhere. Re: sampling - are above requests coming from one host? What's the value of itemCount for telemetry items? Sampling might indeed mask spike (or make them bigger). But since there is overall overhead it doesn't look like sampling. Which language do you use? Is it node.js/java/.net? – ZakiMa Apr 26 '19 at 03:58

1 Answers1

3

Both Azure Monitoring and Application Insights define these metrics as how long it takes your app to respond to requests. Dmitry correctly noted that the difference is primarily because of what piece of the process the service is monitoring. Azure Monitoring is gathering statistings on the web server as a whole. That's why it is reporting on CPU and memory usage in addition to response times. On the other hand, Application Insights is built into your code, so it can only tell you how long your code took to run. It doesn't know how much of the CPU you are using, but it can tell you things about your code, like how long a database call took. For this reason I would expect the app service to report a higher number than App Insights.

Sampling probably won't have a significant impact on the difference- at the very least you wouldn't expect that difference to be so consistant over time. One thing that can definitely have an impact is if you have multiple apps on the same app service. Azure Monitor is looking at all the apps on the service, whereas Application Insights is only looking at that one app.

PerfectlyPanda
  • 3,271
  • 1
  • 6
  • 17
  • Thanks, but I'm still looking for an answer on the specific differences. I understand Azure monitor will 'see more', due to the level higher up it's monitoring. So I guess my question is: what does Azure monitor 'average response time's include? Where is the gap? I can't see how there can be this much of a difference – RPM1984 May 01 '19 at 21:01
  • It's not possible to say for sure without context. There is going to be some overhead in the web server as it accepts the request, routes it to your code and then returns the results. Just off the top of my head, an app restarting would cause a larger spike in server time as it has to wait for the app to come online. If there are multiple sites on the same host, there's all sorts of things that could happen. The size of the VM will also have an impact- a smaller VM will need to spend more time on all that overhead. – PerfectlyPanda May 02 '19 at 12:49