Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

finops: Enable by default traces sampling

Clémence Lesné87704b94ccaa
diff --git a/.env.example b/.env.example
index ed20015..06fcb32 100644
--- a/.env.example
+++ b/.env.example
@@ -1,4 +1,8 @@
-APPLICATIONINSIGHTS_CONNECTION_STRING=xxx
+# Service Principal (optional)
AZURE_CLIENT_ID=xxx
AZURE_CLIENT_SECRET=xxx
AZURE_TENANT_ID=xxx
+
+# Application Insights (optional)
+APPLICATIONINSIGHTS_CONNECTION_STRING=xxx
+OTEL_TRACES_SAMPLER_ARG=0.5
diff --git a/README.md b/README.md
index 5ef86c6..6914ff8 100644
--- a/README.md
+++ b/README.md
@@ -789,7 +789,7 @@ Optional costs totalizing $343.02 /month, with the following breakdown:
| Region | Metric | Cost | Total (monthly $) | Note |
|-|-|-|-|-|
-| Sweden Central | Basic logs ingestion | $0.645 /GB | $322.5 | 500GB of logs with sampling enabled |
+| Sweden Central | Basic logs ingestion | $0.645 /GB | $322.5 | 500GB of logs [with sampling enabled](https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-configuration?tabs=python#enable-sampling) |
### What would it require to make it production ready?
diff --git a/cicd/bicep/app.bicep b/cicd/bicep/app.bicep
index 1f4578f..37c7e42 100644
--- a/cicd/bicep/app.bicep
+++ b/cicd/bicep/app.bicep
@@ -219,6 +219,10 @@ resource containerApp 'Microsoft.App/containerApps@2024-02-02-preview' = {
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: applicationInsights.properties.ConnectionString
}
+ {
+ name: 'OTEL_TRACES_SAMPLER_ARG'
+ value: '0.2' // 20% sampling
+ }
]
resources: {
cpu: 1