Skip to content

Commit 9ada473

Browse files
Merge pull request #208433 from trask/upgrade-from-2x
New upgrade from 2x instructions starting from the 3.4.0 release
2 parents a8018d1 + 5356cce commit 9ada473

File tree

1 file changed

+37
-29
lines changed

1 file changed

+37
-29
lines changed

articles/azure-monitor/app/java-standalone-upgrade-from-2x.md

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,44 @@ ms.reviewer: mmcc
1010

1111
# Upgrading from Application Insights Java 2.x SDK
1212

13-
If you're already using Application Insights Java 2.x SDK in your application, you can keep using it.
14-
The Application Insights Java 3.x agent will detect it,
15-
and capture and correlate any custom telemetry you're sending via the 2.x SDK,
16-
while suppressing any auto-collection performed by the 2.x SDK to prevent duplicate telemetry.
13+
There are typically no code changes when upgrading to 3.x. The 3.x SDK dependencies are just no-op API versions of the
14+
2.x SDK dependencies, but when used along with the 3.x Java agent, the 3.x Java agent provides the implementation
15+
for them, and your custom instrumentation will be correlated with all the new
16+
auto-instrumentation which is provided by the 3.x Java agent.
1717

18-
If you were using Application Insights 2.x agent, you need to remove the `-javaagent:` JVM arg
19-
that was pointing to the 2.x agent.
18+
## Step 1: Update dependencies
2019

21-
The rest of this document describes limitations and changes that you may encounter
22-
when upgrading from 2.x to 3.x, as well as some workarounds that you may find helpful.
20+
| 2.x dependency | Action | Remarks |
21+
|----------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
22+
| `applicationinsights-core` | Update the version to `3.4.0` or later | |
23+
| `applicationinsights-web` | Update the version to `3.4.0` or later, and remove the Application Insights web filter your `web.xml` file. | |
24+
| `applicationinsights-web-auto` | Replace with `3.4.0` or later of `applicationinsights-web` | |
25+
| `applicationinsights-logging-log4j1_2` | Remove the dependency and remove the Application Insights appender from your log4j configuration. | No longer needed since Log4j 1.2 is auto-instrumented in the 3.x Java agent. |
26+
| `applicationinsights-logging-log4j2` | Remove the dependency and remove the Application Insights appender from your log4j configuration. | No longer needed since Log4j 2 is auto-instrumented in the 3.x Java agent. |
27+
| `applicationinsights-logging-log4j1_2` | Remove the dependency and remove the Application Insights appender from your logback configuration. | No longer needed since Logback is auto-instrumented in the 3.x Java agent. |
28+
| `applicationinsights-spring-boot-starter` | Replace with `3.4.0` or later of `applicationinsights-web` | The cloud role name will no longer default to `spring.application.name`, see the [3.x configuration docs](./java-standalone-config.md#cloud-role-name) for configuring the cloud role name. |
29+
30+
## Step 2: Add the 3.x Java agent
31+
32+
Add the 3.x Java agent to your JVM command-line args, for example
33+
34+
```
35+
-javaagent:path/to/applicationinsights-agent-3.4.0.jar
36+
```
37+
38+
If you were using the Application Insights 2.x Java agent, just replace your existing `-javaagent:...` with the above.
39+
40+
> [!Note]
41+
> If you were using the spring-boot-starter and if you prefer, there is an alternative to using the Java agent. See [3.x Spring Boot](./java-spring-boot.md).
2342
43+
## Step 3: Configure your Application Insights connection string
2444

45+
See [configuring the connection string](./java-standalone-config.md#connection-string).
46+
47+
## Additional notes
48+
49+
The rest of this document describes limitations and changes that you may encounter
50+
when upgrading from 2.x to 3.x, as well as some workarounds that you may find helpful.
2551

2652
## TelemetryInitializers and TelemetryProcessors
2753

@@ -38,12 +64,12 @@ This use case is supported in Application Insights Java 3.x using [Instrumentati
3864

3965
## Operation names
4066

41-
In the Application Insights Java 2.x SDK, in some cases, the operation names contained the full path, e.g.
67+
In the Application Insights Java 2.x SDK, in some cases, the operation names contained the full path, for example
4268

4369
:::image type="content" source="media/java-ipa/upgrade-from-2x/operation-names-with-full-path.png" alt-text="Screenshot showing operation names with full path":::
4470

4571
Operation names in Application Insights Java 3.x have changed to generally provide a better aggregated view
46-
in the Application Insights Portal U/X, e.g.
72+
in the Application Insights Portal U/X, for example
4773

4874
:::image type="content" source="media/java-ipa/upgrade-from-2x/operation-names-parameterized.png" alt-text="Screenshot showing operation names parameterized":::
4975

@@ -56,7 +82,7 @@ The snippet below configures 3 telemetry processors that combine to replicate th
5682
The telemetry processors perform the following actions (in order):
5783

5884
1. The first telemetry processor is an attribute processor (has type `attribute`),
59-
which means it applies to all telemetry which has attributes
85+
which means it applies to all telemetry that has attributes
6086
(currently `requests` and `dependencies`, but soon also `traces`).
6187

6288
It will match any telemetry that has attributes named `http.method` and `http.url`.
@@ -126,21 +152,3 @@ The telemetry processors perform the following actions (in order):
126152
}
127153
}
128154
```
129-
130-
## 2.x SDK logging appenders
131-
132-
Application Insights Java 3.x [auto-collects logging](./java-standalone-config.md#auto-collected-logging)
133-
without the need for configuring any logging appenders.
134-
If you are using 2.x SDK logging appenders, those can be removed,
135-
as they will be suppressed by the Application Insights Java 3.x anyways.
136-
137-
## 2.x SDK spring boot starter
138-
139-
There is no Application Insights Java 3.x spring boot starter.
140-
3.x setup and configuration follows the same [simple steps](./java-in-process-agent.md#get-started)
141-
whether you are using spring boot or not.
142-
143-
When upgrading from the Application Insights Java 2.x SDK spring boot starter,
144-
note that the cloud role name will no longer default to `spring.application.name`.
145-
See the [3.x configuration docs](./java-standalone-config.md#cloud-role-name)
146-
for setting the cloud role name in 3.x via json config or environment variable.

0 commit comments

Comments
 (0)