Commit 22bef88
authored
Enable AWS Resource Detectors without AppSignals (#1064)
*Issue #, if available:*
AWS Resource Detectors are currently only enabled when Application
Signals are enabled. This behavior is different than other languages
which enables the detectors regardless of AppSignals.
*Description of changes:*
Modified the logic in auto instrumentation Java Agent to enable resource
detection (except for Lambda) without AppSignals.
*Test*
Ran a sample app on EC2 instance with ADOT Java Agent with the following
environment variables:
```
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=false
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/traces
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
export OTEL_LOGS_EXPORTER=console
export OTEL_LOGS_EXPORTER_ENDPOINT=none
export OTEL_METRICS_EXPORTER=none
export OTEL_SERVICE_NAME=TEST_SERVICE
export OTEL_TRACES_EXPORTER=otlp
```
```
{
"resource": {
"attributes": {
"telemetry.distro.version": "0.1.0-aws-SNAPSHOT",
"host.image.id": "ami-0520f976ad2e6300c",
"process.command_args": [
"/usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java",
"-javaagent:aws-opentelemetry-agent-0.1.0-SNAPSHOT.jar",
"-jar",
"springboot-0.1.0-SNAPSHOT.jar"
],
"process.runtime.version": "17.0.14+7-LTS",
"os.type": "linux",
"process.pid": 55316,
"host.type": "c5a.24xlarge",
"cloud.availability_zone": "us-west-2c",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.language": "java",
"process.runtime.name": "OpenJDK Runtime Environment",
"service.instance.id": "72cec347-f7c4-45a8-af2f-a32499369180",
"os.description": "Linux 5.10.234-225.910.amzn2.x86_64",
"host.arch": "amd64",
"host.name": "ip-172-31-3-59.us-west-2.compute.internal",
"telemetry.sdk.version": "1.44.1",
"cloud.platform": "aws_ec2",
"host.id": "i-0e25b376bf0712221",
"cloud.region": "us-west-2",
"service.name": "TEST_SERVICE",
"telemetry.distro.name": "opentelemetry-java-instrumentation",
"cloud.provider": "aws",
"cloud.account.id": "571600841604",
"process.executable.path": "/usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java",
"process.runtime.description": "Amazon.com Inc. OpenJDK 64-Bit Server VM 17.0.14+7-LTS"
}
},
"scope": {
"name": "io.opentelemetry.tomcat-7.0",
"version": "2.10.0-adot2-alpha"
},
"traceId": "67e45a374dd6a83b8020378076267f10",
"spanId": "20068445f37a26a1",
"flags": 257,
"name": "GET /aws-sdk-call",
"kind": "SERVER",
"startTimeUnixNano": 1743018551621291762,
"endTimeUnixNano": 1743018551637426307,
"durationNano": 16134545,
"attributes": {
"user_agent.original": "curl/8.3.0",
"aws.local.service": "TEST_SERVICE",
"telemetry.extended": "true",
"network.protocol.version": "1.1",
"network.peer.port": 41904,
"url.scheme": "http",
"thread.name": "http-nio-127.0.0.1-8080-exec-10",
"aws.local.environment": "ec2:default",
"server.address": "127.0.0.1",
"client.address": "127.0.0.1",
"network.peer.address": "127.0.0.1",
"aws.local.operation": "GET /aws-sdk-call",
"http.status_code": 200,
"aws.span.kind": "LOCAL_ROOT",
"url.path": "/aws-sdk-call",
"http.request.method": "GET",
"http.route": "/aws-sdk-call",
"server.port": 8080,
"PlatformType": "AWS::EC2",
"http.response.status_code": 200,
"thread.id": 52
},
"status": {
"code": "UNSET"
}
}
```
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.1 parent 24dd4aa commit 22bef88
File tree
1 file changed
+34
-15
lines changed- awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers
1 file changed
+34
-15
lines changedLines changed: 34 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
201 | 210 | | |
202 | | - | |
| 211 | + | |
| 212 | + | |
203 | 213 | | |
204 | 214 | | |
205 | 215 | | |
| |||
236 | 246 | | |
237 | 247 | | |
238 | 248 | | |
239 | | - | |
240 | 249 | | |
241 | | - | |
| 250 | + | |
| 251 | + | |
242 | 252 | | |
243 | 253 | | |
244 | 254 | | |
245 | 255 | | |
246 | 256 | | |
247 | 257 | | |
248 | 258 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
256 | 266 | | |
257 | | - | |
| 267 | + | |
| 268 | + | |
258 | 269 | | |
259 | 270 | | |
260 | 271 | | |
| |||
265 | 276 | | |
266 | 277 | | |
267 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
268 | 287 | | |
269 | 288 | | |
270 | 289 | | |
| |||
0 commit comments