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/java-application-performance-management-config.md
+30-28Lines changed: 30 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ ms.custom: devx-track-azurecli
7
7
ms.topic: tutorial
8
8
ms.date: 11/4/2024
9
9
ms.author: kuzhong
10
-
author: karler
10
+
author: KarlErickson
11
11
---
12
12
13
-
# Tutorial: Configure Application Performance Management (APM) Java agent with init-container in Azure Container Apps
13
+
# Tutorial: Configure the Application Performance Management (APM) Java agent with init containers in Azure Container Apps
14
14
15
-
This article shows you how to configure Application Performance Management (APM) Java agent with init containers in Azure Container Apps, which injects APM solutions without modifying your app image. While you can package the APM plugin in the same image or Dockerfile with your app, doing that binds together management efforts like release and Common Vulnerabilities and Exposures (CVE) mitigation.
15
+
This article shows you how to configure the Application Performance Management (APM) Java agent with init containers in Azure Container Apps. APM helps power observability for your container apps. You can package the APM plugin in the same image or Dockerfile with your app, but it binds together the management concerns, like release and Common Vulnerabilities and Exposures (CVE) mitigation. Rather than binding the concerns together, you can use the Java agent and init containers in Azure Container Apps to inject APM solutions without modifying your app image.
16
16
17
17
In this tutorial, you learn how to:
18
18
@@ -58,7 +58,7 @@ The following steps define environment variables and ensure your Container Apps
58
58
$LOCATION="eastus"
59
59
```
60
60
61
-
1. To sign in to Azure CLI, use the following commands:
61
+
1. Sign in to the Azure CLI by using the following commands:
62
62
63
63
# [Bash](#tab/bash)
64
64
@@ -74,7 +74,7 @@ The following steps define environment variables and ensure your Container Apps
74
74
az account set --subscription $SUBSCRIPTION_ID
75
75
```
76
76
77
-
1. To ensure you have the latest version of Azure CLI extensions for Container Apps and Application Insights, use the following commands:
77
+
1. Ensure that you have the latest version of the Azure CLI extensions for Container Apps and Application Insights by using the following commands:
78
78
79
79
# [Bash](#tab/bash)
80
80
@@ -90,7 +90,7 @@ The following steps define environment variables and ensure your Container Apps
90
90
az extension add --name application-insights --upgrade
91
91
```
92
92
93
-
1. To retrieve the connection string of Application Insights, use the following commands:
93
+
1. Retrieve the connection string for Application Insights by using the following commands:
94
94
95
95
# [Bash](#tab/bash)
96
96
@@ -110,11 +110,11 @@ The following steps define environment variables and ensure your Container Apps
110
110
111
111
## Prepare the container image
112
112
113
-
To build a setup image forApplication Insights Java agent, perform the following stepsin the same directory:
113
+
To build a setup image forApplication Insights Java agent, use the following stepsin the same directory:
114
114
115
-
1. Save the following Dockerfile:
115
+
1. Create a Dockerfile with the following contents:
116
116
117
-
```Dockerfile
117
+
```dockerfile
118
118
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0
119
119
120
120
ARG version="3.5.4"
@@ -128,9 +128,9 @@ To build a setup image for Application Insights Java agent, perform the followin
128
128
ENTRYPOINT ["/bin/sh", "setup.sh"]
129
129
```
130
130
131
-
1. Save the following setup script:
131
+
1. Create a file named **setup.sh** and add the following contents:
132
132
133
-
```setup.sh
133
+
```bash
134
134
#!/bin/sh
135
135
136
136
if [[ -z"$CONNECTION_STRING" ]];then
@@ -142,7 +142,7 @@ To build a setup image for Application Insights Java agent, perform the followin
142
142
fi
143
143
```
144
144
145
-
1. Run the following command to create the image:
145
+
1. Use the following command to create the image:
146
146
147
147
# [Bash](#tab/bash)
148
148
@@ -177,13 +177,13 @@ To build a setup image for Application Insights Java agent, perform the followin
177
177
178
178
## Create a Container Apps environment and a Container App as the target Java app
179
179
180
-
To create a Container Apps environment and a container app as the target Java app, perform the following steps:
180
+
To create a Container Apps environment and a container app as the target Java app, use the following steps:
181
181
182
182
1. Create a Container Apps environment by using the following command:
183
183
184
184
# [Bash](#tab/bash)
185
185
186
-
```bash
186
+
```azurecli
187
187
az containerapp env create \
188
188
--name $ENVIRONMENT_NAME \
189
189
--resource-group $RESOURCE_GROUP \
@@ -193,17 +193,19 @@ To create a Container Apps environment and a container app as the target Java ap
193
193
194
194
# [PowerShell](#tab/powershell)
195
195
196
-
```powershell
196
+
```azurepowershell
197
197
az containerapp env create `
198
198
--name $ENVIRONMENT_NAME`
199
199
--resource-group $RESOURCE_GROUP`
200
200
--location "$LOCATION"`
201
201
--query "properties.provisioningState"
202
202
```
203
203
204
+
---
205
+
204
206
After successfully creating the Container Apps environment, the command line returns a `Succeeded` message.
205
207
206
-
1. Create a Container app for further configurations by using the following command:
208
+
1. Create a container app for further configurations by using the following command:
207
209
208
210
# [Bash](#tab/bash)
209
211
@@ -229,9 +231,9 @@ To create a Container Apps environment and a container app as the target Java ap
229
231
230
232
## Configure init container, secrets, environment variables, and volumes to set up Application Insights integration
231
233
232
-
To configure your init container with secrets, environment variables, and volumes so it can be used with Insights, perform the following steps:
234
+
Use the following steps to configure your init container with secrets, environment variables, and volumes so you can use them with Application Insights:
233
235
234
-
1. Write the current configurations of the running Container App to **app.yml**in the current directory, by using the following command:
236
+
1. Write the current configurations of the running Container App to **app.yaml**in the current directory, by using the following command:
235
237
236
238
# [Bash](#tab/bash)
237
239
@@ -253,9 +255,9 @@ To configure your init container with secrets, environment variables, and volume
253
255
> app.yaml
254
256
```
255
257
256
-
1. Edit the configurations in**app.yml** by using the following instructions:
258
+
1. Edit **app.yaml** by using the following steps:
257
259
258
-
1. Add a secret for Application Insights connection string using the following code snippet:
260
+
1. Add a secret forthe Application Insights connection string using the following example. Be sure to replace `$CONNECTION_STRING` with your Application Insights connection string.
259
261
260
262
```yaml
261
263
properties:
@@ -267,7 +269,7 @@ To configure your init container with secrets, environment variables, and volume
267
269
268
270
Replace $CONNECTION_STRING with your Azure Application Insights connection string.
269
271
270
-
1. Add ephemeral storage volume for Java agent files using the following code snippet:
272
+
1. Add an ephemeral storage volume for Java agent files by using the following code example:
271
273
272
274
```yaml
273
275
properties:
@@ -277,7 +279,7 @@ To configure your init container with secrets, environment variables, and volume
277
279
storageType: EmptyDir
278
280
```
279
281
280
-
1. Add an init container with volume mounts and environment variables, using the following code snippet:
282
+
1. Add an init container with volume mounts and environment variables by using the following example. Be sure to replace `<CONTAINER_REGISTRY_NAME>` with your Azure Container Registry name.
281
283
282
284
```yaml
283
285
properties:
@@ -296,9 +298,7 @@ To configure your init container with secrets, environment variables, and volume
296
298
volumeName: java-agent-volume
297
299
```
298
300
299
-
Replace `<CONTAINER_REGISTRY_NAME>` with your Azure Container Registry name.
300
-
301
-
1. Update the app container with volume mounts and environment variables, using the following code snippets:
301
+
1. Update the app container with volume mounts and environment variables by using the following example:
302
302
303
303
```yaml
304
304
properties:
@@ -317,7 +317,7 @@ To configure your init container with secrets, environment variables, and volume
317
317
volumeName: java-agent-volume
318
318
```
319
319
320
-
1. Update the container app with the modified YAML file, using the following command:
320
+
1. Update the container app with the modified YAML file by using the following command:
321
321
322
322
# [Bash](#tab/bash)
323
323
@@ -339,11 +339,13 @@ To configure your init container with secrets, environment variables, and volume
339
339
--query "properties.provisioningState"
340
340
```
341
341
342
-
After updating the container app, the command returns a `Succeeded` message. Then you can view your Application Insights in the Azure portal to verify that your container app is connected.
342
+
---
343
+
344
+
After updating the container app, the command returns a `Succeeded` message. Then, you can verify that your container app is connected by viewing your Application Insights instance in the Azure portal.
343
345
344
346
## Clean up resources
345
347
346
-
The resource group you created in this tutorial contributes to your Azure bill. If you aren't going to need it in the long term, use the following command to remove it:
348
+
The resources you created in this tutorial contribute to your Azure bill. If you aren't going to need them in the long term, use the following command to remove the resource group, which also removes all the resources it contains:
0 commit comments