Application Insights Sampling

George Luiz Bittencourt 21 Reputation points Microsoft Employee
2022-05-24T21:08:48.49+00:00

Hello,

I am about to use Application Insights to calculate some metrics about our response time and I am afraid that sampling might impact our metrics.
My question is very simple, if I have a record on the request table and the itemCount is 5 and this request has failed, the other 4 requests were not saved because sampling might have been completed successfully

The itemCount counts the number of records discarded, but they might be completely different from the one that got saved.
Is that understanding correct?

Thanks,

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,800 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 19,691 Reputation points
    2022-05-25T08:42:32.72+00:00

    Hi @George Luiz Bittencourt

    Welcome to Microsoft Q&A! Thanks for posting the question.

    Yes, your understanding is almost correct - with one modification. itemCount=<sampling ratio>. Therefore, based on the example in question, for a record if itemCount is 5 - it would mean that this single record represents 5 telemetry (4 of which were sampled out). Thus itemCount=<sampling ratio> = 5/1 = 5. Also, the sampled record (both the stored one as well as the discarded out ones) will be independent of each other. The App Insights SDK, however, samples based on operation_Id, meaning that an operation_Id is selected and all of the telemetry for that single operation are ingested and saved (not random individual records). This enables the end-to-end transaction view of the stored telemetry record.

    You may refer to the following links for more details:

    1. How sampling works - The example scenario should help clear much of the doubts.
    2. StackOverFlow discussion for "Azure App Insights Sampling (ItemCount)"

    Please let me know if you have any questions.

    ---
    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Varun Sharma 11 Reputation points
    2022-11-24T11:35:01.163+00:00

    @George Luiz Bittencourt - a bit late but to answer your question- if you see a request with itemCount = 5 and this specific request failed then that doesn't mean that the other 4 also failed. The reason is because the decision to sample is made at the beginning of the request and so at that point it is not known whether the request will succeed or fail. So if itemCount is 5 then it could be 4 failed, 1 success or 1 failed, 4 success etc.

    1 person found this answer helpful.
    0 comments No comments