With the basics in place, episode two asks a practical question: how do you actually see what your AI calls are doing in production? The answer is OpenTelemetry, wired up with a trace provider and a meter provider that export data to Azure Application Insights. Because a console app doesn’t get the automatic request tracking that a web app or API would have out of the box, a custom activity has to be started manually to make the telemetry show up properly as a request in App Insights. Once that’s running, the payoff becomes clear: a custom request event, an SDK-generated dependency call to Azure OpenAI, and token usage metrics all land in App Insights, ready to be queried with KQL to summarize consumption by hour or by application.

The code for this sample is here: https://github.com/michaelstephensonuk/azure-ai-samples/tree/main/02.helloworld.logging

 

Buy Me A Coffee