|
1 |
| -# Observe application behavior |
2 |
| - |
3 |
| -## Semantic Kernel and Observability |
4 |
| - |
5 |
| -It's worth taking a minute to read these two pages about observability with semantic kernel: |
6 |
| -[Observability in Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/concepts/enterprise-readiness/observability) |
7 |
| - |
8 |
| -## Observability Architecture |
9 |
| - |
10 |
| -This application uses the [Open Telemetry](https://opentelemetry.io/) standard for shipping application tracing data to three telemetry destinations: |
11 |
| -- [.NET Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview?tabs=bash), an OTEL-based dashboard for viewing application behavior. |
12 |
| -- [Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview), Azure's application observability service. |
13 |
| -- Console log |
14 |
| - |
15 |
| -## How does the app send telemetry data to observability destinations? |
16 |
| - |
17 |
| -The application uses the python `opentelemetry` sdk to send data to various destinations. The sdk uses base classes `LogProvider`, `SpanProvider` and `MetricProvider` to send data to various endpoints. In [utility.py]('..\..\voice_agent\app\backend\utility.py) the application uses specific implementations of those classes to send telemetry data to the destinations. |
18 |
| - |
19 |
| -## What observability resources are deployed to my resource group? |
20 |
| - |
21 |
| -### Aspire Dashboard |
22 |
| - |
23 |
| -The bicep infrastructure deploys Aspire Dashboard as a standalone ACA container called `aspire-dashboard`. You can find it in the list of resources in your resource group. Browse the dashboard by clicking the container link. |
24 |
| - |
25 |
| - |
26 |
| - |
27 |
| -### Application Insights Resource |
28 |
| - |
29 |
| -The bicep infrastructure deploys an Application Insights resource where you can observe your telemetry data. Use the following features to observe semantic kernel behavior in App Insights: |
30 |
| - |
31 |
| -## Observe Application Behavior |
32 |
| - |
33 |
| -### Local Configuration |
34 |
| - |
35 |
| -You can see telemetry data if you are running the app locally, in a local dev container, or in Azure via `azd up`. It will not work if you're running in Github Codespaces. |
36 |
| - |
37 |
| -If running locally or in a dev container, there are configuration steps to wire up the Aspire Dashboard: |
38 |
| -1. Update the `.env` file with this value: `TELEMETRY_SCENARIO=console,aspire_dashboard` |
39 |
| -1. Run this command to host the Aspire Dashboard in a local container: |
40 |
| - |
41 |
| - ```bash |
42 |
| - docker run --rm -it -d -p 18888:18888 -p 4317:18889 -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true --name aspire-dashboard mcr.microsoft.com/dotnet/aspire-dashboard:9.0 |
43 |
| - ``` |
44 |
| - |
45 |
| -If running locally (not in a dev container), update the `.env` file with this value: `ASPIRE_DASHBOARD_ENDPOINT=http://localhost:4317` |
46 |
| - |
47 |
| -No additional steps are needed if you are running the app that was deployed by `azd up`. |
48 |
| - |
49 |
| -### Conduct a conversation with the customer service agents |
50 |
| - |
51 |
| -Conduct a conversation with the customer service agents following this sequence: |
52 |
| -- Ask about your upcoming hotel stay |
53 |
| -- Upgrade the room to a suite |
54 |
| -- Ask about your upcoming flights |
55 |
| -- Upgrade your seat to Business class |
56 |
| - |
57 |
| -### Observe application behavior in Aspire Dashboard |
58 |
| - |
59 |
| -- Go to your resource group in Azure Portal |
60 |
| -- Click on the `aspire-dashboard` resource |
61 |
| -- Click on the `Application URL` in the top right corner to navigate to the dashboard |
62 |
| - |
63 |
| -- Observe the application log showing the conversation you conducted. Locate an entry: "Function hotel_tools-load_user_reservation_info invoking." and click on the Trace link. This navigates you to the Trace page for that function call. |
64 |
| -- Observe the details of the trace, such as the duration and other metadata. |
65 |
| - |
66 |
| -- Click on the Traces navigation on the left. |
67 |
| -- Observe the sequence of function calls and confirm it matches the conversation you had. Drill into traces to see information as desired. |
68 |
| - |
69 |
| -- Click on the Metrics navigation on the left. |
70 |
| -- Click on the function duration metric to see the duration on the most recent function calls. |
71 |
| - |
72 |
| - |
73 |
| - |
74 |
| -## Application Environment Variables |
75 |
| - |
76 |
| -- You can disable specific OTEL destinations by adjusting the `TELEMETRY_SCENARIO` variable. By default it is `console,application_insights,aspire_dashboard`. You can remove any destination from the list by and re-deploy by this sequence: |
77 |
| - - Go to the `backend` ACA app |
78 |
| - - Click on containers |
79 |
| - - Click on Environment Variables |
80 |
| - - Adjust the value as desired |
81 |
| - - Click `Deploy as new revision`. This will deploy a new revision of the backend app with your new value. |
82 |
| ---- |
| 1 | +# Observe application behavior |
| 2 | + |
| 3 | +## Semantic Kernel and Observability |
| 4 | + |
| 5 | +It's worth taking a minute to read these two pages about observability with semantic kernel: |
| 6 | +[Observability in Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/concepts/enterprise-readiness/observability) |
| 7 | + |
| 8 | +## Observability Architecture |
| 9 | + |
| 10 | +This application uses the [Open Telemetry](https://opentelemetry.io/) standard for shipping application tracing data to three telemetry destinations: |
| 11 | +- [.NET Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview?tabs=bash), an OTEL-based dashboard for viewing application behavior. |
| 12 | +- [Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview), Azure's application observability service. |
| 13 | +- Console log |
| 14 | + |
| 15 | +## How does the app send telemetry data to observability destinations? |
| 16 | + |
| 17 | +The application uses the python `opentelemetry` sdk to send data to various destinations. The sdk uses base classes `LogProvider`, `SpanProvider` and `MetricProvider` to send data to various endpoints. In [utility.py]('..\..\voice_agent\app\backend\utility.py) the application uses specific implementations of those classes to send telemetry data to the destinations. |
| 18 | + |
| 19 | +## What observability resources are deployed to my resource group? |
| 20 | + |
| 21 | +### Aspire Dashboard |
| 22 | + |
| 23 | +The bicep infrastructure deploys Aspire Dashboard as a standalone ACA container called `aspire-dashboard`. You can find it in the list of resources in your resource group. Browse the dashboard by clicking the container link. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +### Application Insights Resource |
| 28 | + |
| 29 | +The bicep infrastructure deploys an Application Insights resource where you can observe your telemetry data. Use the following features to observe semantic kernel behavior in App Insights: |
| 30 | + |
| 31 | +## Observe Application Behavior |
| 32 | + |
| 33 | +### Local Configuration |
| 34 | + |
| 35 | +You can see telemetry data if you are running the app locally, in a local dev container, or in Azure via `azd up`. It will not work if you're running in Github Codespaces. |
| 36 | + |
| 37 | +If running locally or in a dev container, there are configuration steps to wire up the Aspire Dashboard: |
| 38 | +1. Update the `.env` file with this value: `TELEMETRY_SCENARIO=console,aspire_dashboard` |
| 39 | +1. Run this command to host the Aspire Dashboard in a local container: |
| 40 | + |
| 41 | + ```bash |
| 42 | + docker run --rm -it -d -p 18888:18888 -p 4317:18889 -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true --name aspire-dashboard mcr.microsoft.com/dotnet/aspire-dashboard:9.0 |
| 43 | + ``` |
| 44 | + |
| 45 | +If running locally (not in a dev container), update the `.env` file with this value: `ASPIRE_DASHBOARD_ENDPOINT=http://localhost:4317` |
| 46 | + |
| 47 | +No additional steps are needed if you are running the app that was deployed by `azd up`. |
| 48 | + |
| 49 | +### Conduct a conversation with the customer service agents |
| 50 | + |
| 51 | +Conduct a conversation with the customer service agents following this sequence: |
| 52 | +- Ask about your upcoming hotel stay |
| 53 | +- Upgrade the room to a suite |
| 54 | +- Ask about your upcoming flights |
| 55 | +- Upgrade your seat to Business class |
| 56 | + |
| 57 | +### Observe application behavior in Aspire Dashboard |
| 58 | + |
| 59 | +- Go to your resource group in Azure Portal |
| 60 | +- Click on the `aspire-dashboard` resource |
| 61 | +- Click on the `Application URL` in the top right corner to navigate to the dashboard |
| 62 | + |
| 63 | +- Observe the application log showing the conversation you conducted. Locate an entry: "Function hotel_tools-load_user_reservation_info invoking." and click on the Trace link. This navigates you to the Trace page for that function call. |
| 64 | +- Observe the details of the trace, such as the duration and other metadata. |
| 65 | + |
| 66 | +- Click on the Traces navigation on the left. |
| 67 | +- Observe the sequence of function calls and confirm it matches the conversation you had. Drill into traces to see information as desired. |
| 68 | + |
| 69 | +- Click on the Metrics navigation on the left. |
| 70 | +- Click on the function duration metric to see the duration on the most recent function calls. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +## Application Environment Variables |
| 75 | + |
| 76 | +- You can disable specific OTEL destinations by adjusting the `TELEMETRY_SCENARIO` variable. By default it is `console,application_insights,aspire_dashboard`. You can remove any destination from the list by and re-deploy by this sequence: |
| 77 | + - Go to the `backend` ACA app |
| 78 | + - Click on containers |
| 79 | + - Click on Environment Variables |
| 80 | + - Adjust the value as desired |
| 81 | + - Click `Deploy as new revision`. This will deploy a new revision of the backend app with your new value. |
| 82 | +--- |
83 | 83 | #### Navigation: [Home](../../README.md) | [Previous Section](../02_setup/README.md) | [Next Section](../04_explore/README.md)
|
0 commit comments