Microsoft Azure Developer Associate AZ-204 Practice Question
You are developing an Azure Function that uses Application Insights. Inside a catch block you must send the caught exception together with a string property named CustomerId and a numeric metric named ElapsedMs. A TelemetryClient instance named telemetryClient is already available. Which method call should you use to meet the requirement?
telemetryClient.TrackEvent("ExceptionCaught", new Dictionary<string,string>{{"CustomerId", customerId}}, new Dictionary<string,double>{{"ElapsedMs", elapsedMs}});
telemetryClient.TrackTrace("Exception", SeverityLevel.Error, new Dictionary<string,string>{{"CustomerId", customerId}});
telemetryClient.TrackException(ex, new Dictionary<string,string>{{"CustomerId", customerId}}, new Dictionary<string,double>{{"ElapsedMs", elapsedMs}});
The overload of TelemetryClient.TrackException that accepts an Exception plus two dictionaries lets you attach both custom string properties and numeric metrics in the same call. Passing the exception object, a dictionary that contains the "CustomerId" key, and another dictionary that contains the "ElapsedMs" key ensures all requested data is included in the exception telemetry sent to Application Insights. The other options either omit the metric, use TrackTrace, or use TrackEvent, none of which satisfy the requirement to record both the exception and the custom metric in a single exception telemetry item.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is Application Insights?
Open an interactive chat with Bash
What is a TelemetryClient in Azure?
Open an interactive chat with Bash
Why use dictionaries with TrackException in Application Insights?
Open an interactive chat with Bash
Microsoft Azure Developer Associate AZ-204
Monitor and troubleshoot Azure solutions
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .