Skip to content

Commit f3e0227

Browse files
updated azure config
1 parent 26076a5 commit f3e0227

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

agent-framework/user-guide/observability.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,20 @@ The `configure_otel_providers()` function automatically reads standard OpenTelem
333333

334334
See the [OpenTelemetry spec](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/) for more details.
335335

336-
### Azure AI Foundry setup
336+
### Microsoft Foundry setup
337337

338-
Azure AI Foundry has built-in support for tracing with visualization for your spans.
338+
Microsoft Foundry has built-in support for tracing with visualization for your spans.
339339

340-
For Azure AI projects, use the `client.configure_azure_monitor()` method:
340+
Make sure you have your Foundry configured with a Azure Monitor instance, for details see [Foundry docs](/azure/ai-foundry/how-to/monitor-applications?view=foundry-classic)
341+
342+
#### Install the `azure-monitor-opentelemetry` package:
343+
344+
```bash
345+
pip install azure-monitor-opentelemetry
346+
```
347+
348+
#### Configure observability directly from the `AzureAIClient`:
349+
For Azure AI Foundry projects, you can configure observability directly from the `AzureAIClient`:
341350

342351
```python
343352
from agent_framework.azure import AzureAIClient
@@ -354,15 +363,11 @@ async def main():
354363
await client.configure_azure_monitor(enable_live_metrics=True)
355364
```
356365

357-
For non-Azure AI projects with Application Insights:
358366

359-
1) Install the `azure-monitor-opentelemetry` package:
367+
#### Configure azure monitor and optionally enable instrumentation:
368+
For non-Azure AI projects with Application Insights, make sure you setup a custom agent in Foundry, see [details](azure/ai-foundry/control-plane/register-custom-agent?view=foundry).
360369

361-
```bash
362-
pip install azure-monitor-opentelemetry
363-
```
364-
365-
2) Configure observability:
370+
Then run your agent with the same _OpenTelemetry agent ID_ as registered in Foundry, and configure azure monitor as follows:
366371

367372
```python
368373
from azure.monitor.opentelemetry import configure_azure_monitor
@@ -373,7 +378,17 @@ configure_azure_monitor(
373378
resource=create_resource(),
374379
enable_live_metrics=True,
375380
)
381+
# optional if you do not have ENABLE_INSTRUMENTATION in env vars
376382
enable_instrumentation()
383+
384+
# Create your agent with the same OpenTelemetry agent ID as registered in Foundry
385+
agent = ChatAgent(
386+
chat_client=...,
387+
name="My Agent",
388+
instructions="You are a helpful assistant.",
389+
id="<OpenTelemetry agent ID>"
390+
)
391+
# use the agent as normal
377392
```
378393

379394
### Aspire Dashboard

0 commit comments

Comments
 (0)