Application Insights – Metrics, Logs and Traces · AZ-204: Developing Solutions for Microsoft Azure Monitor and Troubleshoot Azure Solutions
A .NET worker records one CPU-utilization value every second and needs an accurate one-minute average in Application Insights Metrics Explorer. Which…
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.
easy · MCQ · Q-3A6691
A .NET worker records one CPU-utilization value every second and needs an accurate one-minute average in Application Insights Metrics Explorer. Which code is the most appropriate way to record the custom metric?
- A.telemetryClient.TrackTrace($"CPU: {cpuPercent}");
- B.telemetryClient.GetMetric("CpuUtilization").TrackValue(cpuPercent);Correct answer
- C.telemetryClient.TrackEvent("CpuUtilization", new Dictionary<string, string> { ["Value"] = cpuPercent.ToString() });
- D.telemetryClient.TrackRequest("CpuUtilization", DateTimeOffset.UtcNow, TimeSpan.FromSeconds(cpuPercent), "200", true);
Solution
GetMetric creates a custom metric that aggregates values locally before sending them to Application Insights. Metrics Explorer can then calculate the one-minute average efficiently. Traces and events are logs, not numeric metric measurements.
More from Application Insights – Metrics, Logs and Traces
- A production ASP.NET Core API uses Application Insights. The operations team wants a dashboard showing the number of failed requests and th…
- An application sends request and trace telemetry to a workspace-based Application Insights resource. You need to find failed requests toget…
- A multi-instance .NET service must publish a reliable count of checkout attempts. Adaptive sampling is enabled for request and trace teleme…
- An ASP.NET Core application sends informational traces with a custom property named Region. You need a KQL query that returns only trace me…
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 freeFree to start · No credit card needed