Application Insights – Metrics, Logs and Traces · AZ-204: Developing Solutions for Microsoft Azure Monitor and Troubleshoot Azure Solutions

A multi-instance .NET service must publish a reliable count of checkout attempts. Adaptive sampling is enabled for request and trace telemetry, and t…

Practice question from Application Insights – Metrics, Logs and Traces (AZ-204: Developing Solutions for Microsoft Azure Monitor and Troubleshoot Azure Solutions), with the correct answer and a step-by-step solution.

hard · MCQ · Q-635074

A multi-instance .NET service must publish a reliable count of checkout attempts. Adaptive sampling is enabled for request and trace telemetry, and the count must remain accurate even when traffic is high. Which implementation is most appropriate?

  1. A.Call telemetryClient.TrackEvent("CheckoutAttempt") for every checkout and rely on the sampled event count.
  2. B.Create a metric with telemetryClient.GetMetric("CheckoutAttempts") and call metric.TrackValue(1) for each checkout attempt.Correct answer
  3. C.Write an informational ILogger message for every checkout and count the resulting AppTraces records.
  4. D.Call telemetryClient.TrackTrace("CheckoutAttempt") for every checkout and disable metric aggregation.

Solution

GetMetric creates a locally preaggregated custom metric, reducing telemetry volume and avoiding the loss of counts caused by sampling individual events or traces. Application Insights aggregates the metric data from the service instances, making it suitable for a high-volume count.

More from Application Insights – Metrics, Logs and Traces

All of Application Insights – Metrics, Logs and Traces

Practise more Monitor and Troubleshoot Azure Solutions

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed