Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request telemetry - "durationMetric"?

When parsing exported Application Insights telemetry from Blob storage, the request data looks something like this:

{
  "request": [
    {
      "id": "3Pc0MZMBJgQ=",
      "name": "POST Blah",
      "count": 6,
      "responseCode": 201,
      "success": true,
      "url": "https://example.com/api/blah",
      "durationMetric": {
        "value": 66359508.0,
        "count": 6.0,
        "min": 11059918.0,
        "max": 11059918.0,
        "stdDev": 0.0,
        "sampledValue": 11059918.0
      },
      ...
    }
  ],
  ...
}

I am looking for the duration of the request, but I see that I am presented with a durationMetric object.

According to the documentation the request[0].durationMetric.value field is described as

Time from request arriving to response. 1e7 == 1s

But if I query this using Analytics, the value don't match up to this field:

enter image description here

They do, however, match up to the min, max and sampledValue fields.

Which field should I use? And what does that "value": 66359508.0 value represent in the above example?

like image 515
Dave New Avatar asked Oct 05 '16 14:10

Dave New


1 Answers

It doesn't match because you're seeing sampled data (meaning this event represents sampled data from multiple requests). I'd recommend starting with https://azure.microsoft.com/en-us/documentation/articles/app-insights-sampling/ to understand how sampling works.

In this case, the "matching" value would come from duration.sampledValue (notice that value == count * sampledValue)

It's hard to compare exactly what you're seeing because you don't show the Kusto query you're using, but you do need to be aware of sampling when writing AI Analytics queries. See https://azure.microsoft.com/en-us/documentation/articles/app-insights-analytics-tour/#counting-sampled-data for more details on the latter.

like image 100
tomasr Avatar answered Oct 03 '22 00:10

tomasr