-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Like AWS X-Ray, provide an instrumentor which automatically registers opentelemetry instrumentation in the AWS SDK without any code changes. Those instrumentors are separate libraries published as opentelemetry-aws-sdk-1.11-instrumentor and opentelemetry-aws-sdk-2.2-instrumentor
- Loading branch information
1 parent
123de52
commit b84ad1e
Showing
17 changed files
with
200 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
id("otel.library-instrumentation") | ||
} | ||
|
||
base.archivesName.set("${base.archivesName.get()}-autoconfigure") | ||
|
||
dependencies { | ||
implementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:library")) | ||
|
||
library("com.amazonaws:aws-java-sdk-core:1.11.0") | ||
|
||
testImplementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:testing")) | ||
|
||
testLibrary("com.amazonaws:aws-java-sdk-s3:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-rds:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-ec2:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-kinesis:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-dynamodb:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-sns:1.11.106") | ||
testLibrary("com.amazonaws:aws-java-sdk-sqs:1.11.106") | ||
} | ||
|
||
tasks.test { | ||
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", "true") | ||
} |
42 changes: 42 additions & 0 deletions
42
...va/io/opentelemetry/instrumentation/awssdk/v1_11/autoconfigure/TracingRequestHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v1_11.autoconfigure; | ||
|
||
import com.amazonaws.AmazonWebServiceRequest; | ||
import com.amazonaws.Request; | ||
import com.amazonaws.Response; | ||
import com.amazonaws.handlers.RequestHandler2; | ||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import io.opentelemetry.instrumentation.awssdk.v1_11.AwsSdkTracing; | ||
|
||
/** | ||
* A {@link RequestHandler2} for use as an SPI by the AWS SDK to automatically trace all requests. | ||
*/ | ||
public class TracingRequestHandler extends RequestHandler2 { | ||
|
||
private static final RequestHandler2 DELEGATE = | ||
AwsSdkTracing.fromAgentConfig(GlobalOpenTelemetry.get()).newRequestHandler(); | ||
|
||
@Override | ||
public void beforeRequest(Request<?> request) { | ||
DELEGATE.beforeRequest(request); | ||
} | ||
|
||
@Override | ||
public AmazonWebServiceRequest beforeMarshalling(AmazonWebServiceRequest request) { | ||
return DELEGATE.beforeMarshalling(request); | ||
} | ||
|
||
@Override | ||
public void afterResponse(Request<?> request, Response<?> response) { | ||
DELEGATE.afterResponse(request, response); | ||
} | ||
|
||
@Override | ||
public void afterError(Request<?> request, Response<?> response, Exception e) { | ||
DELEGATE.afterError(request, response, e); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.../library-autoconfigure/src/main/resources/com/amazonaws/global/handlers/request.handler2s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.opentelemetry.instrumentation.awssdk.v1_11.autoconfigure.TracingRequestHandler |
16 changes: 16 additions & 0 deletions
16
...t/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/instrumentor/Aws1ClientTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v1_11.instrumentor | ||
|
||
import io.opentelemetry.instrumentation.awssdk.v1_11.AbstractAws1ClientTest | ||
import io.opentelemetry.instrumentation.test.LibraryTestTrait | ||
|
||
class Aws1ClientTest extends AbstractAws1ClientTest implements LibraryTestTrait { | ||
@Override | ||
def configureClient(def client) { | ||
return client | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...t/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/instrumentor/SqsTracingTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v1_11.instrumentor | ||
|
||
import com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder | ||
import io.opentelemetry.instrumentation.awssdk.v1_11.AbstractSqsTracingTest | ||
import io.opentelemetry.instrumentation.test.LibraryTestTrait | ||
|
||
class SqsTracingTest extends AbstractSqsTracingTest implements LibraryTestTrait { | ||
@Override | ||
AmazonSQSAsyncClientBuilder configureClient(AmazonSQSAsyncClientBuilder client) { | ||
return client | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...avaagent/src/main/resources/software/amazon/awssdk/global/handlers/execution.interceptors
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
id("otel.library-instrumentation") | ||
} | ||
|
||
base.archivesName.set("${base.archivesName.get()}-autoconfigure") | ||
|
||
dependencies { | ||
implementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:library")) | ||
|
||
library("software.amazon.awssdk:aws-core:2.2.0") | ||
library("software.amazon.awssdk:aws-json-protocol:2.2.0") | ||
|
||
testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing")) | ||
|
||
latestDepTestLibrary("software.amazon.awssdk:kinesis:+") | ||
} | ||
|
||
tasks { | ||
test { | ||
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true) | ||
} | ||
} |
Oops, something went wrong.