@@ -10,65 +10,30 @@ ms.reviewer: mmcc
10
10
11
11
# Upgrading from Application Insights Java 2.x SDK
12
12
13
- ## Step-by-step
14
-
15
- #### Step 1
16
-
17
- If you are using ` applicationinsights-core ` and/or ` applicationinsights-web ` dependencies, update those to the latest
18
- 3.x version, e.g.
19
-
20
- Change
21
-
22
- ```
23
- <dependency>
24
- <groupId>com.microsoft.azure</groupId>
25
- <artifactId>applicationinsights-core</artifactId>
26
- <version>2.6.4</version>
27
- </dependency>
28
- ```
29
-
30
- to
31
-
32
- ```
33
- <dependency>
34
- <groupId>com.microsoft.azure</groupId>
35
- <artifactId>applicationinsights-core</artifactId>
36
- <version>3.4.0</version>
37
- </dependency>
38
- ```
39
-
40
- #### Step 2
41
-
42
- If you are using ` applicationinsights-web-auto ` dependency, remove that and replace it with the latest 3.x version of
43
- ` applicationinsights-web ` , e.g.
44
-
45
- Change
46
-
47
- ```
48
- <dependency>
49
- <groupId>com.microsoft.azure</groupId>
50
- <artifactId>applicationinsights-web-auto</artifactId>
51
- <version>2.6.4</version>
52
- </dependency>
53
- ```
54
-
55
- to
56
-
57
- ```
58
- <dependency>
59
- <groupId>com.microsoft.azure</groupId>
60
- <artifactId>applicationinsights-web</artifactId>
61
- <version>3.4.0</version>
62
- </dependency>
63
- ```
64
-
65
- #### Step 3
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 in conjunction with the 3.x Javaagent, the 3.x Javaagent provides the implementation
15
+ for these 3.x SDK dependencies, so that any of your custom instrumentation will be correlated with all of the new
16
+ auto-instrumentation which is provided by the 3.x Javaagent.
17
+
18
+ ## Step 1: Update dependencies
19
+
20
+ * If you are using ` applicationinsights-core ` and/or ` applicationinsights-web ` dependencies, update those to the latest
21
+ 3.x version.
22
+ * If you are using ` applicationinsights-web-auto ` dependency, remove that and replace it with the latest 3.x version of
23
+ ` applicationinsights-web ` .
24
+ * If you are using ` applicationinsights-logging-log4j1_2 ` , ` applicationinsights-logging-log4j2 ` ,
25
+ and/or ` applicationinsights-logging-logback ` , remove those dependencies, since loggers are now auto-instrumented in
26
+ 3.x and these custom logging appenders are no longer needed.
27
+ * If you are using ` applicationinsights-spring-boot-starter ` , remove that and replace it with the latest 3.x version of
28
+ ` applicationinsights-web ` .
29
+ * Note: the cloud role name will no longer default to ` spring.application.name ` , see the
30
+ [ 3.x configuration docs] ( ./java-standalone-config.md#cloud-role-name ) for configuring the cloud role name.
31
+
32
+ ## Step 2: Remove references from web.xml (if any)
66
33
67
34
If you have the Application Insights web filter ` com.microsoft.applicationinsights.web.internal.WebRequestTrackingFilter `
68
35
added your web.xml, remove that, since requests are now auto-instrumented in 3.x and this custom web filter is no longer
69
- needed, e.g.
70
-
71
- Remove
36
+ needed, e.g. remove
72
37
73
38
```
74
39
<filter>
@@ -81,79 +46,20 @@ Remove
81
46
</filter-mapping>
82
47
```
83
48
84
- #### Step 4
49
+ ## Step 3: Add the 3.x Javaagent
85
50
86
- If you are using ` applicationinsights-logging-log4j1_2 ` , ` applicationinsights-logging-log4j2 ` ,
87
- and/or ` applicationinsights-logging-logback ` , remove those dependencies, since loggers are now auto-instrumented in 3.x
88
- and these custom logging appenders are no longer needed, e.g.
89
-
90
- Remove
91
-
92
- ```
93
- <dependency>
94
- <groupId>com.microsoft.azure</groupId>
95
- <artifactId>applicationinsights-logging-log4j1_2</artifactId>
96
- <version>2.6.4</version>
97
- </dependency>
98
- ```
99
-
100
- #### Step 5
101
-
102
- If you are using ` applicationinsights-spring-boot-starter ` , remove that and replace it with the latest 3.x version of
103
- ` applicationinsights-web ` , e.g.
104
-
105
- Change
106
-
107
- ```
108
- <dependency>
109
- <groupId>com.microsoft.azure</groupId>
110
- <artifactId>applicationinsights-spring-boot-starter</artifactId>
111
- <version>2.6.4</version>
112
- </dependency>
113
- ```
114
-
115
- to
116
-
117
- ```
118
- <dependency>
119
- <groupId>com.microsoft.azure</groupId>
120
- <artifactId>applicationinsights-web</artifactId>
121
- <version>3.4.0</version>
122
- </dependency>
123
- ```
124
-
125
- Note: the cloud role name will no longer default to ` spring.application.name ` , see the
126
- [ 3.x configuration docs] ( ./java-standalone-config.md#cloud-role-name ) for configuring the cloud role name.
127
-
128
- #### Step 6
129
-
130
- If you were using the Application Insights 2.x Javaagent, you need to replace that with the 3.x Javaagent, e.g.
131
-
132
- Change
133
-
134
- ```
135
- -javaagent:path/to/applicationinsights-agent-2.6.4.jar
136
- ```
137
-
138
- to
51
+ Add the 3.x Javaagent to your JVM command-line args, e.g.
139
52
140
53
```
141
54
-javaagent:path/to/applicationinsights-agent-3.4.0.jar
142
55
```
143
56
144
- #### Step 7
145
-
146
- If you were not using the Application Insights 2.x Javaagent, you will need to add the Application Insights 3.x
147
- Javaagent to your JVM args, e.g.
148
-
149
- ```
150
- -javaagent:path/to/applicationinsights-agent-3.4.0.jar
151
- ```
57
+ If you were using the Application Insights 2.x Javaagent, just replace your existing ` -javaagent:... ` with the above.
152
58
153
- Note: if you were using the spring-boot-starter, there is an alternative to using the Javaagent if you prefer , see
59
+ Note: if you were using the spring-boot-starter and if you prefer , there is an alternative to using the Javaagent, see
154
60
[ 3.x Spring Boot] ( ./java-spring-boot.md ) .
155
61
156
- #### Step 8
62
+ #### Step 4: Configure your Application Insights connection string
157
63
158
64
[ Configure the connection string] ( ./java-standalone-config.md#connection-string ) .
159
65
0 commit comments