Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-aws-sdk</artifactId>
Expand Down Expand Up @@ -74,7 +76,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.340</version>
<version>1.11.371</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -124,6 +126,7 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
Expand Down Expand Up @@ -226,7 +229,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static void onRequest(Request request, Span span) {
Tags.COMPONENT.set(span, COMPONENT_NAME);
Tags.HTTP_METHOD.set(span, request.getHttpMethod().name());
Tags.HTTP_URL.set(span, request.getEndpoint().toString());
span.setTag("original_request", request.getOriginalRequest().getClass().getSimpleName());
}

static void onResponse(Response response, Span span) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
Expand Down Expand Up @@ -70,7 +69,22 @@ public void after() throws Exception {
}

@Test
public void two_requests() throws Exception {
public void with_error() {
AmazonDynamoDB dbClient = buildClient();
createTable(dbClient, "table-1");
createTable(dbClient, "table-1");

List<MockSpan> spans = mockTracer.finishedSpans();
assertEquals(2, spans.size());

assertEquals(1, spans.get(1).logEntries().size());
assertEquals(true, spans.get(1).tags().get(Tags.ERROR.getKey()));

assertNull(mockTracer.activeSpan());
}

@Test
public void two_requests() {
AmazonDynamoDB dbClient = buildClient();
createTable(dbClient, "twoRequests-1");
createTable(dbClient, "twoRequests-2");
Expand All @@ -88,7 +102,7 @@ public void two_requests() throws Exception {
public void two_requests_with_parent() {
AmazonDynamoDB dbClient = buildClient();

try (Scope parent = mockTracer.buildSpan("parent-sync").startActive(true)) {
try (Scope ignore = mockTracer.buildSpan("parent-sync").startActive(true)) {
createTable(dbClient, "with-parent-1");
createTable(dbClient, "with-parent-2");
}
Expand Down Expand Up @@ -118,7 +132,7 @@ public void two_requests_with_parent() {
public void async_requests_with_parent() throws Exception {
AmazonDynamoDBAsync dbClient = buildAsyncClient();

try (Scope parent = mockTracer.buildSpan("parent-async").startActive(true)) {
try (Scope ignore = mockTracer.buildSpan("parent-async").startActive(true)) {
Future<CreateTableResult> createTableResultFuture = createTableAsync(dbClient,
"with-async-parent-1");
Future<CreateTableResult> createTableResultFuture2 = createTableAsync(dbClient,
Expand Down Expand Up @@ -172,9 +186,11 @@ private void checkSpans(List<MockSpan> mockSpans) {
for (MockSpan mockSpan : mockSpans) {
assertEquals(Tags.SPAN_KIND_CLIENT, mockSpan.tags().get(Tags.SPAN_KIND.getKey()));
assertEquals(SpanDecorator.COMPONENT_NAME, mockSpan.tags().get(Tags.COMPONENT.getKey()));
assertNull(mockSpan.tags().get(Tags.ERROR.getKey()));
assertEquals(0, mockSpan.logEntries().size());
assertEquals(0, mockSpan.generatedErrors().size());
String operationName = mockSpan.operationName();
assertTrue(operationName.equals("AmazonDynamoDBv2"));
assertEquals("AmazonDynamoDBv2", operationName);
}
}

Expand Down