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
+29-27Lines changed: 29 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ ms.author: kuzhong
11
11
author: KarlErickson
12
12
---
13
13
14
-
# Tutorial: Configure Application Performance Management (APM) Java agent with init-container in Azure Container Apps
14
+
# Tutorial: Configure the Application Performance Management (APM) Java agent with init containers in Azure Container Apps
15
15
16
-
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.
16
+
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.
17
17
18
18
In this tutorial, you learn how to:
19
19
@@ -59,7 +59,7 @@ The following steps define environment variables and ensure your Container Apps
59
59
$LOCATION="eastus"
60
60
```
61
61
62
-
1. To sign in to Azure CLI, use the following commands:
62
+
1. Sign in to the Azure CLI by using the following commands:
63
63
64
64
# [Bash](#tab/bash)
65
65
@@ -75,7 +75,7 @@ The following steps define environment variables and ensure your Container Apps
75
75
az account set --subscription $SUBSCRIPTION_ID
76
76
```
77
77
78
-
1. To ensure you have the latest version of Azure CLI extensions for Container Apps and Application Insights, use the following commands:
78
+
1. Ensure that you have the latest version of the Azure CLI extensions for Container Apps and Application Insights by using the following commands:
79
79
80
80
# [Bash](#tab/bash)
81
81
@@ -91,7 +91,7 @@ The following steps define environment variables and ensure your Container Apps
91
91
az extension add --name application-insights --upgrade
92
92
```
93
93
94
-
1. To retrieve the connection string of Application Insights, use the following commands:
94
+
1. Retrieve the connection string for Application Insights by using the following commands:
95
95
96
96
# [Bash](#tab/bash)
97
97
@@ -111,11 +111,11 @@ The following steps define environment variables and ensure your Container Apps
111
111
112
112
## Prepare the container image
113
113
114
-
To build a setup image forApplication Insights Java agent, perform the following stepsin the same directory:
114
+
To build a setup image forApplication Insights Java agent, use the following stepsin the same directory:
115
115
116
-
1. Save the following Dockerfile:
116
+
1. Create a Dockerfile with the following contents:
117
117
118
-
```Dockerfile
118
+
```dockerfile
119
119
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0
120
120
121
121
ARG version="3.5.4"
@@ -129,9 +129,9 @@ To build a setup image for Application Insights Java agent, perform the followin
129
129
ENTRYPOINT ["/bin/sh", "setup.sh"]
130
130
```
131
131
132
-
1. Save the following setup script:
132
+
1. Create a file named **setup.sh** and add the following contents:
133
133
134
-
```setup.sh
134
+
```bash
135
135
#!/bin/sh
136
136
137
137
if [[ -z"$CONNECTION_STRING" ]];then
@@ -143,7 +143,7 @@ To build a setup image for Application Insights Java agent, perform the followin
143
143
fi
144
144
```
145
145
146
-
1. Run the following command to create the image:
146
+
1. Use the following command to create the image:
147
147
148
148
# [Bash](#tab/bash)
149
149
@@ -178,13 +178,13 @@ To build a setup image for Application Insights Java agent, perform the followin
178
178
179
179
## Create a Container Apps environment and a Container App as the target Java app
180
180
181
-
To create a Container Apps environment and a container app as the target Java app, perform the following steps:
181
+
To create a Container Apps environment and a container app as the target Java app, use the following steps:
182
182
183
183
1. Create a Container Apps environment by using the following command:
184
184
185
185
# [Bash](#tab/bash)
186
186
187
-
```bash
187
+
```azurecli
188
188
az containerapp env create \
189
189
--name $ENVIRONMENT_NAME \
190
190
--resource-group $RESOURCE_GROUP \
@@ -194,17 +194,19 @@ To create a Container Apps environment and a container app as the target Java ap
194
194
195
195
# [PowerShell](#tab/powershell)
196
196
197
-
```powershell
197
+
```azurepowershell
198
198
az containerapp env create `
199
199
--name $ENVIRONMENT_NAME`
200
200
--resource-group $RESOURCE_GROUP`
201
201
--location "$LOCATION"`
202
202
--query "properties.provisioningState"
203
203
```
204
204
205
+
---
206
+
205
207
After successfully creating the Container Apps environment, the command line returns a `Succeeded` message.
206
208
207
-
1. Create a Container app for further configurations by using the following command:
209
+
1. Create a container app for further configurations by using the following command:
208
210
209
211
# [Bash](#tab/bash)
210
212
@@ -230,9 +232,9 @@ To create a Container Apps environment and a container app as the target Java ap
230
232
231
233
## Configure init container, secrets, environment variables, and volumes to set up Application Insights integration
232
234
233
-
To configure your init container with secrets, environment variables, and volumes so it can be used with Insights, perform the following steps:
235
+
Use the following steps to configure your init container with secrets, environment variables, and volumes so you can use them with Application Insights:
234
236
235
-
1. Write the current configurations of the running Container App to **app.yml**in the current directory, by using the following command:
237
+
1. Write the current configurations of the running Container App to **app.yaml**in the current directory, by using the following command:
236
238
237
239
# [Bash](#tab/bash)
238
240
@@ -254,9 +256,9 @@ To configure your init container with secrets, environment variables, and volume
254
256
> app.yaml
255
257
```
256
258
257
-
1. Edit the configurations in**app.yml** by using the following instructions:
259
+
1. Edit **app.yaml** by using the following steps:
258
260
259
-
1. Add a secret for Application Insights connection string using the following code snippet:
261
+
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.
260
262
261
263
```yaml
262
264
properties:
@@ -268,7 +270,7 @@ To configure your init container with secrets, environment variables, and volume
268
270
269
271
Replace $CONNECTION_STRING with your Azure Application Insights connection string.
270
272
271
-
1. Add ephemeral storage volume for Java agent files using the following code snippet:
273
+
1. Add an ephemeral storage volume for Java agent files by using the following code example:
272
274
273
275
```yaml
274
276
properties:
@@ -278,7 +280,7 @@ To configure your init container with secrets, environment variables, and volume
278
280
storageType: EmptyDir
279
281
```
280
282
281
-
1. Add an init container with volume mounts and environment variables, using the following code snippet:
283
+
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.
282
284
283
285
```yaml
284
286
properties:
@@ -297,9 +299,7 @@ To configure your init container with secrets, environment variables, and volume
297
299
volumeName: java-agent-volume
298
300
```
299
301
300
-
Replace `<CONTAINER_REGISTRY_NAME>` with your Azure Container Registry name.
301
-
302
-
1. Update the app container with volume mounts and environment variables, using the following code snippets:
302
+
1. Update the app container with volume mounts and environment variables by using the following example:
303
303
304
304
```yaml
305
305
properties:
@@ -318,7 +318,7 @@ To configure your init container with secrets, environment variables, and volume
318
318
volumeName: java-agent-volume
319
319
```
320
320
321
-
1. Update the container app with the modified YAML file, using the following command:
321
+
1. Update the container app with the modified YAML file by using the following command:
322
322
323
323
# [Bash](#tab/bash)
324
324
@@ -340,11 +340,13 @@ To configure your init container with secrets, environment variables, and volume
340
340
--query "properties.provisioningState"
341
341
```
342
342
343
-
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.
343
+
---
344
+
345
+
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.
344
346
345
347
## Clean up resources
346
348
347
-
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:
349
+
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