You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/opentelemetry-agents.md
+77-21Lines changed: 77 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn to record and query data collected using OpenTelemetry in Azu
4
4
services: container-apps
5
5
author: craigshoemaker
6
6
ms.service: azure-container-apps
7
-
ms.date: 11/01/2024
7
+
ms.date: 12/02/2024
8
8
ms.author: cshoe
9
9
ms.topic: how-to
10
10
---
@@ -25,10 +25,9 @@ OpenTelemetry agents live within your container app environment. You configure a
25
25
26
26
Each endpoint type (Azure Monitor Application Insights, DataDog, and OTLP) has specific configuration requirements.
27
27
28
-
29
28
## Prerequisites
30
29
31
-
Enabling the managed OpenTelemetry agent to your environment doesn't automatically mean the agent collects data. Agents only send data based on your configuration settings and instrumenting your code correctly.
30
+
Enabling the managed OpenTelemetry agent to your environment doesn't automatically mean the agent collects data. Agents only send data based on your configuration settings and instrumenting your code correctly.
32
31
33
32
### Configure source code
34
33
@@ -56,6 +55,10 @@ The following table shows you what type of data you can send to each destination
56
55
57
56
The only configuration detail required from Application Insights is the connection string. Once you have the connection string, you can configure the agent via your container app's ARM template or with Azure CLI commands.
58
57
58
+
The connection string contains an instrumentation key, which is a unique identifier used to associate telemetry to a specific Application Insights resource. Instrumentation keys aren't security tokens or security keys, and aren't considered secrets.
59
+
60
+
If you want to protect your Application Insights resource from misuse, see [Microsoft Entra authentication for Application Insights](/azure/azure-monitor/app/azure-ad-authentication#microsoft-entra-authentication-for-application-insights).
61
+
59
62
# [ARM template](#tab/arm)
60
63
61
64
Before you deploy this template, replace placeholders surrounded by `<>` with your values.
@@ -65,7 +68,7 @@ Before you deploy this template, replace placeholders surrounded by `<>` with yo
> Due to the sensitivity of the connection-string, you will not be able to see the detail values of the connection string when the command returns. The system will display it as null.
100
+
> Due to the sensitivity of the connection-string, you will not be able to see the detail values of the connection string when the command returns. The system will display it as null.
97
101
98
102
---
99
103
@@ -108,13 +112,51 @@ The Datadog agent configuration requires a value for `site` and `key` from your
108
112
109
113
Once you have these configuration details, you can configure the agent via your container app's ARM template or with Azure CLI commands.
110
114
115
+
Avoid specifying the value of a secret, such as your Datadog API key, directly in a production environment. Instead, use a reference to a secret stored in Azure Key Vault.
116
+
117
+
You must enable the key vault for template deployment. To do this, create the key vault with the `enabledForTemplateDeployment` property enabled, or run the following Azure CLI command, replacing the `<KEY_VAULT_NAME>` with your value:
118
+
119
+
```azurecli
120
+
az keyvault update --name <KEY_VAULT_NAME> --enabled-for-template-deployment true
121
+
```
122
+
123
+
For more information, see:
124
+
-[Use Azure Key Vault to pass secure parameter value during deployment](/azure/azure-resource-manager/templates/key-vault-parameter)
125
+
-[Tutorial: Integrate Azure Key Vault in your ARM template deployment](/azure/azure-resource-manager/templates/template-tutorial-use-key-vault)
126
+
111
127
# [ARM template](#tab/arm)
112
128
113
-
Before you deploy this template, replace placeholders surrounded by `<>` with your values.
129
+
Create a [parameter file](/azure/azure-resource-manager/templates/parameter-files) to retrieve your Datadog API key from an Azure Key Vault.
130
+
131
+
Before you deploy the following files, replace placeholders surrounded by `<>` with your values.
You can now reference the `datadogapikey` parameter in your ARM Template.
114
151
115
152
```json
116
153
{
117
154
...
155
+
"parameters": {
156
+
"datadogapikey": {
157
+
"type": "securestring"
158
+
}
159
+
},
118
160
"properties": {
119
161
...
120
162
"openTelemetryConfiguration": {
@@ -137,20 +179,29 @@ Before you deploy this template, replace placeholders surrounded by `<>` with yo
137
179
}
138
180
```
139
181
182
+
To deploy the resource, run the following Azure CLI command, replacing the placeholders surrounded by `<>` with your values.
183
+
184
+
```azurecli
185
+
az deployment group create \
186
+
--resource-group <RESOURCE_GROUP> \
187
+
--template-file <ARM_TEMPLATE_FILE> \
188
+
--parameters <PARAMETER_FILE>
189
+
```
140
190
141
191
# [Azure CLI](#tab/azure-cli)
142
192
143
193
Before you run this command, replace placeholders surrounded by `<>` with your values.
144
194
145
195
```azurecli
146
196
az containerapp env telemetry data-dog set \
147
-
--resource-group <YOUR_RESOURCE_GROUP_NAME> \
148
-
--name <YOUR_ENVIRONMENT_NAME> \
149
-
--site "<YOUR_DATADOG_SUBDOMAIN>.datadoghq.com" \
150
-
--key <YOUR_DATADOG_KEY> \
197
+
--resource-group <RESOURCE_GROUP_NAME> \
198
+
--name <ENVIRONMENT_NAME> \
199
+
--site "<DATADOG_SUBDOMAIN>.datadoghq.com" \
200
+
--key <DATADOG_KEY> \
151
201
--enable-open-telemetry-traces true \
152
202
--enable-open-telemetry-metrics true
153
203
```
204
+
154
205
>[!NOTE]
155
206
> Due to the sensitivity of the key, you will not be able to see the detail values of the key when the command returns. The system will display it as null.
156
207
@@ -208,25 +259,26 @@ While you can set up as many OTLP-configured endpoints as you like, each endpoin
208
259
209
260
```azurecli
210
261
az containerapp env telemetry otlp add \
211
-
--resource-group <YOUR_RESOURCE_GROUP_NAME> \
212
-
--name <YOUR_ENVIRONMENT_NAME> \
262
+
--resource-group <RESOURCE_GROUP_NAME> \
263
+
--name <ENVIRONMENT_NAME> \
213
264
--otlp-name "otlp1" \
214
265
--endpoint "ENDPOINT_URL_1" \
215
266
--insecure false \
216
267
--headers "api-key-1=key" \
217
268
--enable-open-telemetry-traces true \
218
269
--enable-open-telemetry-metrics true
219
270
az containerapp env telemetry otlp add \
220
-
--resource-group <YOUR_RESOURCE_GROUP_NAME> \
221
-
--name <YOUR_ENVIRONMENT_NAME> \
271
+
--resource-group <RESOURCE_GROUP_NAME> \
272
+
--name <ENVIRONMENT_NAME> \
222
273
--otlp-name "otlp2" \
223
274
--endpoint "ENDPOINT_URL_2" \
224
275
--insecure true \
225
276
--enable-open-telemetry-traces true \
226
277
--enable-open-telemetry-logs true
227
278
```
279
+
228
280
>[!NOTE]
229
-
> Due to the sensitivity of the headers value, you will not be able to see the detail values of the headers value when the command returns. The system will display them as null.
281
+
> Due to the sensitivity of the headers value, you will not be able to see the detail values of the headers value when the command returns. The system will display them as null.
|`otlp-name`| A name you select to identify your OTLP-configured endpoint. |
238
290
|`endpoint`| The URL of the destination that receives collected data. |
239
291
|`insecure`| Default true. Defines whether to enable client transport security for the exporter's gRPC connection. If false, the `headers` parameter is required. |
240
-
|`headers`| Space-separated values, in 'key=value' format, that provide required information for the OTLP endpoints' security. Example: `"api-key=key other-config-value=value"`. |
292
+
|`headers`| Space-separated values, in 'key=value' format, that provides required information for the OTLP endpoints' security. Example: `"api-key=key other-config-value=value"`. |
241
293
242
294
## Configure Data Destinations
243
295
@@ -298,6 +350,8 @@ The following example shows how to use an OTLP endpoint named `customDashboard`.
298
350
299
351
The following example ARM template shows how you might configure your container app to collect telemetry data using Azure Monitor Application Insights, Datadog, and with a custom OTLP agent named `customDashboard`.
300
352
353
+
This example works with the parameter file used to retrieve the [Datadog API](#datadog) key from an Azure Key Vault.
354
+
301
355
Before you deploy this template, replace placeholders surrounded by `<>` with your values.
302
356
303
357
```json
@@ -311,7 +365,7 @@ Before you deploy this template, replace placeholders surrounded by `<>` with yo
311
365
"destinationsConfiguration": {
312
366
"dataDogConfiguration": {
313
367
"site": "datadoghq.com",
314
-
"key": "<YOUR_DATADOG_KEY>"
368
+
"key": "parameters('datadogapikey')]"
315
369
},
316
370
"otlpConfigurations": [
317
371
{
@@ -344,6 +398,8 @@ Before you deploy this template, replace placeholders surrounded by `<>` with yo
344
398
}
345
399
```
346
400
401
+
For more information, see [Microsoft.App/managedEnvironments](/azure/templates/microsoft.app/2024-02-02-preview/managedenvironments).
402
+
347
403
## Environment variables
348
404
349
405
The OpenTelemetry agent automatically injects a set of environment variables into your application at runtime.
@@ -369,7 +425,7 @@ These variables are only necessary if you're using both the managed OpenTelemetr
369
425
370
426
## OpenTelemetry agent costs
371
427
372
-
You are[billed](./billing.md) for the underlying compute of the agent.
428
+
You're[billed](./billing.md) for the underlying compute of the agent.
373
429
374
430
See the destination service for their billing structure and terms. For example, if you send data to both Azure Monitor Application Insights and Datadog, you're responsible for the charges applied by both services.
0 commit comments