
The Azure AI SDK automatically captures relevant invocation and usage metrics from each API call and logs them to Statsig. These events stream in real time in the console at https://console.statsig.com/metrics/events.

{% figure %}
![Statsig console events streaming interface](/images/integrations/azureai/capturing-metrics/cb4136eb-6ae9-4ffa-b560-333f332eaa75.png)
{% /figure %}

### Metrics captured

Completion invocations capture the following metrics automatically: completion token length, prompt token length, latency, model name, total token length.

For example, a completion API call results in a usage log that looks like this:

{% figure %}
![Azure AI completion API usage log example](/images/integrations/azureai/capturing-metrics/d9c150cc-eded-4607-aec8-d1631af77cec.png)
{% /figure %}

You can use these metrics to compare multiple deployments and run experiments against different parameter sets, helping optimize cost, responsiveness, and user experience.
