Skip to content

Commit 5d0935e

Browse files
committed
Review comments
1 parent c0a4e2a commit 5d0935e

File tree

1 file changed

+35
-25
lines changed

1 file changed

+35
-25
lines changed

articles/azure-app-configuration/howto-telemetry-python.md

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,36 +105,46 @@ In this tutorial, you use telemetry in your Python application to track feature
105105
export APPLICATIONINSIGHTS_CONNECTION_STRING='applicationinsights-connection-string'
106106
```
107107
108-
1. If your environment variable for your App Configuration store endpoint isn't setup. Set the `AzureAppConfigurationEndpoint` environment variable to the endpoint of your App Configuration store.
109-
110-
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
111-
112-
```cmd
113-
setx AzureAppConfigurationEndpoint "<endpoint-of-your-app-configuration-store>"
114-
```
115-
116-
If you use PowerShell, run the following command:
117-
118-
```powershell
119-
$Env:AzureAppConfigurationEndpoint = "<endpoint-of-your-app-configuration-store>"
120-
```
121-
122-
If you use macOS or Linux, run the following command:
123-
124-
```bash
125-
export AzureAppConfigurationEndpoint='<endpoint-of-your-app-configuration-store'
126-
```
127-
128-
1. In the command prompt, in the *QuoteOfTheDay* folder, run: `flask run`.
129-
1. Wait for the app to start, and then open a browser and navigate to `http://localhost:5000/`.
108+
1. Run the application, [see step 2 of Use variant feature flags](./howto-variant-feature-flags-python.md#build-and-run-the-app) .
130109
1. Create 10 different users and log into the application. As you log in with each user, you get a different message variant for some of them. ~50% of the time you get no message. 25% of the time you get the message "Hello!" and 25% of the time you get "I hope this makes your day!".
131110
1. With some of the users select the **Like** button to trigger the telemetry event.
132111
1. Open your Application Insights resource in the Azure portal and select **Logs** under **Monitoring**. In the query window, run the following query to see the telemetry events:
133112
134113
```kusto
135-
customEvents
136-
| where name == "FeatureEvaluation" or name == "Liked"
137-
| order by timestamp desc
114+
// Total users
115+
let total_users =
116+
customEvents
117+
| where name == "FeatureEvaluation"
118+
| summarize TotalUsers = count() by Variant = tostring(customDimensions.Variant);
119+
120+
// Hearted users
121+
let hearted_users =
122+
customEvents
123+
| where name == "FeatureEvaluation"
124+
| extend TargetingId = tostring(customDimensions.TargetingId)
125+
| join kind=inner (
126+
customEvents
127+
| where name == "Liked"
128+
| extend TargetingId = tostring(customDimensions.TargetingId)
129+
) on TargetingId
130+
| summarize HeartedUsers = count() by Variant = tostring(customDimensions.Variant);
131+
132+
// Calculate the percentage of hearted users over total users
133+
let combined_data =
134+
total_users
135+
| join kind=leftouter (hearted_users) on Variant
136+
| extend HeartedUsers = coalesce(HeartedUsers, 0)
137+
| extend PercentageHearted = strcat(round(HeartedUsers * 100.0 / TotalUsers, 1), "%")
138+
| project Variant, TotalUsers, HeartedUsers, PercentageHearted;
139+
140+
// Calculate the sum of total users and hearted users of all variants
141+
let total_sum =
142+
combined_data
143+
| summarize Variant="All", TotalUsers = sum(TotalUsers), HeartedUsers = sum(HeartedUsers);
144+
145+
// Display the combined data along with the sum of total users and hearted users
146+
combined_data
147+
| union (total_sum)
138148
```
139149
140150
You see one "FeatureEvaluation" for each time the quote page was loaded and one "Liked" event for each time the like button was clicked. The "FeatureEvaluation" event have a custom property called `FeatureName` with the name of the feature flag that was evaluated. Both events have a custom property called `TargetingId` with the name of the user that liked the quote.

0 commit comments

Comments
 (0)