Commit 98d2ccd
authored
Migrate to OpenTelemetry Java agent for automatic instrumentation (#590)
* Migrate to OpenTelemetry Java agent for automatic instrumentation
Replaces manual instrumentation with the OTel Java agent (v2.26.0).
Removes manual instrumentation libraries for AWS SDK, OkHttp, and Logback.
The agent automatically instruments these libraries without code changes.
Changes:
- Add OTel agent download and distribution to all deployment paths
- Upgrade OTel SDK from 1.45.0 to 1.60.1
- Remove manual instrumentation dependencies and code
- Simplify AWS client configuration (agent handles tracing)
- Remove Logback OTel appender (agent handles log export)
All deployment paths now use the agent: development, distribution, and containers.
* Remove manual OpenTelemetry instrumentation
The OpenTelemetry Java agent handles all instrumentation automatically.
Manual instrumentation is redundant and creates version conflicts.
Changes:
- Remove opentelemetry-sdk-extension-autoconfigure dependency (conflicts with agent)
- Remove all OpenTelemetry SDK dependencies from libs.versions.toml
- Delete entire observability/ package (TelemetryProvider, OtelTelemetryProvider, etc.)
- Remove all manual instrumentation calls (withSpan, recordDuration, incrementCounter)
- Remove telemetryProvider from DefaultRemoteOperationsService, CommandExecutor, K8s services
- Remove unused telemetryProvider parameter from AWSModule and AWSClientFactory
- Update all tests to remove TelemetryProvider mocks
The Java agent now handles all instrumentation: AWS SDK, HTTP clients,
JDBC/Cassandra driver, JVM metrics, and logging.
* Use version catalog for opentelemetry-javaagent dependency
Instead of hardcoding the version in build.gradle.kts, reference the
opentelemetry-agent version from libs.versions.toml to avoid drift.
* Update OpenTelemetry documentation for agent-only approach
Rewrites docs/reference/opentelemetry.md to reflect the removal of
manual instrumentation. Key changes:
- Clarifies that the agent is always loaded but only exports telemetry
when OTEL_EXPORTER_OTLP_ENDPOINT is set (minimal overhead when unset)
- Removes "Instrumented Operations" section describing deleted custom spans
- Removes "Metrics" table listing deleted custom metrics
- Removes "Shutdown Warnings" troubleshooting entry for deleted shutdown hook
- Emphasizes "automatic instrumentation only - there is no custom manual
instrumentation in the CLI tool code"
Updates CLAUDE.md to remove outdated reference to deleted observability/
package and replace with accurate description of Java agent-based
automatic instrumentation.
* Fix OTLP endpoint configuration in end-to-end tests
Configures the OpenTelemetry Java agent to use gRPC protocol when
connecting to the OTLP collector in docker compose. The agent was
defaulting to HTTP protocol and attempting to append paths to the
endpoint, causing "unexpected end of stream" errors.
Changes:
- Discover OTLP collector port from docker compose using `port` command
- Export OTEL_EXPORTER_OTLP_ENDPOINT with the discovered port mapping
- Export OTEL_EXPORTER_OTLP_PROTOCOL=grpc to force gRPC protocol
This ensures tests can successfully export telemetry to the local
collector without connection errors.
* Suppress logging output to prevent pollution of machine-readable stdout
Commands like `show-iam-policies` (sip) output JSON that's consumed by
shell scripts. kotlin-logging initialization messages and OpenTelemetry
agent logs were polluting stdout, causing AWS IAM to reject the output
as malformed JSON.
Changes:
- Make Main.kt logger lazy and suppress kotlin-logging startup message
- Route OTel agent logs through logback instead of stdout
- Use consistent agent path in bin/easy-db-lab (installDist location)
This ensures commands can safely redirect stdout for machine parsing.
* Suppress JVM Class Data Sharing warning
Add -Xshare:off to suppress "Sharing is only supported for boot loader
classes because bootstrap classpath has been appended" warning that
occurs when using the OpenTelemetry javaagent.1 parent 4ec42d2 commit 98d2ccd
File tree
31 files changed
+197
-1113
lines changed- bin
- docs/reference
- gradle
- src
- main
- kotlin/com/rustyrazorblade/easydblab
- di
- observability
- providers
- aws
- ssh
- services
- resources
- test/kotlin/com/rustyrazorblade/easydblab
- di
- observability
- providers/ssh
- services
31 files changed
+197
-1113
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1457 | 1457 | | |
1458 | 1458 | | |
1459 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
1460 | 1467 | | |
1461 | 1468 | | |
1462 | 1469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
24 | 41 | | |
25 | 42 | | |
26 | 43 | | |
| |||
36 | 53 | | |
37 | 54 | | |
38 | 55 | | |
| 56 | + | |
39 | 57 | | |
40 | 58 | | |
41 | 59 | | |
| |||
64 | 82 | | |
65 | 83 | | |
66 | 84 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
| |||
137 | 147 | | |
138 | 148 | | |
139 | 149 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
| |||
241 | 248 | | |
242 | 249 | | |
243 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| |||
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
254 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
255 | 273 | | |
256 | 274 | | |
257 | 275 | | |
| |||
330 | 348 | | |
331 | 349 | | |
332 | 350 | | |
| 351 | + | |
333 | 352 | | |
334 | 353 | | |
335 | 354 | | |
| |||
345 | 364 | | |
346 | 365 | | |
347 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
348 | 371 | | |
349 | 372 | | |
350 | 373 | | |
| |||
364 | 387 | | |
365 | 388 | | |
366 | 389 | | |
| 390 | + | |
367 | 391 | | |
368 | 392 | | |
369 | 393 | | |
370 | 394 | | |
| 395 | + | |
371 | 396 | | |
372 | 397 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
6 | 15 | | |
7 | 16 | | |
8 | 17 | | |
| |||
13 | 22 | | |
14 | 23 | | |
15 | 24 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 29 | + | |
34 | 30 | | |
35 | | - | |
| 31 | + | |
36 | 32 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 33 | + | |
62 | 34 | | |
63 | 35 | | |
64 | 36 | | |
| |||
73 | 45 | | |
74 | 46 | | |
75 | 47 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 48 | + | |
90 | 49 | | |
91 | 50 | | |
92 | 51 | | |
| |||
100 | 59 | | |
101 | 60 | | |
102 | 61 | | |
103 | | - | |
| 62 | + | |
104 | 63 | | |
105 | 64 | | |
106 | 65 | | |
| |||
115 | 74 | | |
116 | 75 | | |
117 | 76 | | |
118 | | - | |
| 77 | + | |
119 | 78 | | |
120 | 79 | | |
121 | 80 | | |
| |||
127 | 86 | | |
128 | 87 | | |
129 | 88 | | |
130 | | - | |
| 89 | + | |
131 | 90 | | |
132 | 91 | | |
133 | 92 | | |
| |||
139 | 98 | | |
140 | 99 | | |
141 | 100 | | |
142 | | - | |
| 101 | + | |
143 | 102 | | |
144 | 103 | | |
145 | 104 | | |
| |||
153 | 112 | | |
154 | 113 | | |
155 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
156 | 122 | | |
157 | 123 | | |
158 | 124 | | |
159 | 125 | | |
160 | 126 | | |
161 | 127 | | |
162 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
163 | 131 | | |
164 | | - | |
| 132 | + | |
165 | 133 | | |
166 | 134 | | |
167 | 135 | | |
| |||
198 | 166 | | |
199 | 167 | | |
200 | 168 | | |
201 | | - | |
| 169 | + | |
202 | 170 | | |
203 | 171 | | |
204 | 172 | | |
205 | 173 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 69 | + | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| |||
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 173 | | |
188 | 174 | | |
189 | 175 | | |
| |||
217 | 203 | | |
218 | 204 | | |
219 | 205 | | |
220 | | - | |
221 | | - | |
222 | 206 | | |
223 | 207 | | |
224 | 208 | | |
| |||
0 commit comments