Skip to content

Commit

Permalink
deps: updates to Brave 6 and Zipkin Reporter 3 (#208)
Browse files Browse the repository at this point in the history
Brave no longer has dependencies on zipkin types. To fully remove this
dependency requires Zipkin Reporter 3 which repackages a few base types.

Call sites don't require changes, except dependency alignment. However,
this sets to the next major version as it is a change.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
codefromthecrypt authored Jan 9, 2024
1 parent 4a82042 commit 5f0f423
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 178 deletions.
2 changes: 1 addition & 1 deletion aws-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>io.zipkin.aws</groupId>
<artifactId>zipkin-aws-parent</artifactId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>zipkin-aws-junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion brave/instrumentation-aws-java-sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
package brave.instrumentation.aws;

import brave.Span;
import brave.SpanCustomizer;
import brave.handler.MutableSpan;
import brave.http.HttpAdapter;
import brave.http.HttpClientParser;
import brave.http.HttpResponseParser;
import brave.http.HttpTags;
import brave.test.http.ITHttpClient;
Expand Down Expand Up @@ -115,52 +112,6 @@ public class ITTracingRequestHandler extends ITHttpClient<AmazonDynamoDB> {
testSpanHandler.takeLocalSpan();
}

/** Service and span names don't conform to expectations. */
@Override
@Deprecated @Test public void supportsDeprecatedPortableCustomization() {
String uri = "/"; // This test doesn't currently allow non-root HTTP paths

closeClient(client);
httpTracing = httpTracing.toBuilder()
.clientParser(new HttpClientParser() {
@Override
public <Req> void request(HttpAdapter<Req, ?> adapter, Req req,
SpanCustomizer customizer) {
customizer.name(adapter.method(req).toLowerCase() + " " + adapter.path(req));
customizer.tag("http.url", adapter.url(req)); // just the path is tagged by default
customizer.tag("context.visible", String.valueOf(currentTraceContext.get() != null));
customizer.tag("request_customizer.is_span", (customizer instanceof brave.Span) + "");
}

@Override
public <Resp> void response(HttpAdapter<?, Resp> adapter, Resp res, Throwable error,
SpanCustomizer customizer) {
super.response(adapter, res, error, customizer);
customizer.tag("response_customizer.is_span", (customizer instanceof brave.Span) + "");
}
})
.build().clientOf("remote-service");

client = newClient(server.getPort());
server.enqueue(new MockResponse());
get(client, uri);

MutableSpan span = testSpanHandler.takeRemoteSpan(Span.Kind.CLIENT);
assertThat(span.name())
.isEqualTo("GetItem"); // Overwrites default span name

assertThat(span.remoteServiceName())
.isEqualTo("AmazonDynamoDBv2"); // Ignores HttpTracing.serverName()

assertThat(span.tags())
.containsEntry("http.url", url(uri))
.containsEntry("context.visible", "true")
.containsEntry("request_customizer.is_span", "false")
.containsEntry("response_customizer.is_span", "false");

testSpanHandler.takeLocalSpan();
}

/** Body's inherently have a structure, and we use the operation name as the span name */
@Override public void post() {
String path = "table";
Expand Down
2 changes: 1 addition & 1 deletion brave/instrumentation-aws-java-sdk-sqs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion brave/instrumentation-aws-java-sdk-v2-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -14,13 +14,13 @@
package brave.instrumentation.awsv2;

import brave.http.HttpTracing;
import brave.internal.Nullable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
import software.amazon.awssdk.http.SdkHttpRequest;
import software.amazon.awssdk.http.SdkHttpResponse;
import zipkin2.internal.Nullable;

public final class AwsSdkTracing {
public static AwsSdkTracing create(HttpTracing httpTracing) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -18,6 +18,7 @@
import brave.http.HttpTracing;
import brave.instrumentation.awsv2.AwsSdkTracing.HttpClientRequest;
import brave.instrumentation.awsv2.AwsSdkTracing.HttpClientResponse;
import brave.internal.Nullable;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.interceptor.Context;
Expand All @@ -26,7 +27,6 @@
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute;
import software.amazon.awssdk.http.SdkHttpRequest;
import zipkin2.internal.Nullable;

/**
* Traces AWS Java SDK V2 calls. Adds on the standard zipkin/brave http tags, as well as tags that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
package brave.instrumentation.awsv2;

import brave.Span;
import brave.SpanCustomizer;
import brave.handler.MutableSpan;
import brave.http.HttpAdapter;
import brave.http.HttpClientParser;
import brave.http.HttpResponseParser;
import brave.http.HttpTags;
import brave.test.http.ITHttpClient;
Expand Down Expand Up @@ -156,50 +153,6 @@ SdkHttpClient primeHttpClient() throws IOException {
.containsEntry("response_customizer.is_span", "false");
}

/** Service and span names don't conform to expectations. */
@Override
@Deprecated @Test public void supportsDeprecatedPortableCustomization() throws IOException {
String uri = "/"; // This test doesn't currently allow non-root HTTP paths

closeClient(client);
httpTracing = httpTracing.toBuilder()
.clientParser(new HttpClientParser() {
@Override
public <Req> void request(HttpAdapter<Req, ?> adapter, Req req,
SpanCustomizer customizer) {
customizer.name(adapter.method(req).toLowerCase() + " " + adapter.path(req));
customizer.tag("http.url", adapter.url(req)); // just the path is tagged by default
customizer.tag("context.visible", String.valueOf(currentTraceContext.get() != null));
customizer.tag("request_customizer.is_span", (customizer instanceof brave.Span) + "");
}

@Override
public <Resp> void response(HttpAdapter<?, Resp> adapter, Resp res, Throwable error,
SpanCustomizer customizer) {
super.response(adapter, res, error, customizer);
customizer.tag("response_customizer.is_span", (customizer instanceof brave.Span) + "");
}
})
.build().clientOf("remote-service");

client = newClient(server.getPort());
server.enqueue(new MockResponse());
get(client, uri);

MutableSpan span = testSpanHandler.takeRemoteSpan(Span.Kind.CLIENT);
assertThat(span.name())
.isEqualTo("GetItem"); // Overwrites default span name

assertThat(span.remoteServiceName())
.isEqualTo("DynamoDb"); // Ignores HttpTracing.serverName()

assertThat(span.tags())
.containsEntry("http.url", url(uri))
.containsEntry("context.visible", "true")
.containsEntry("request_customizer.is_span", "false")
.containsEntry("response_customizer.is_span", "false");
}

/** Body's inherently have a structure, and we use the operation name as the span name */
@Override public void post() {
String path = "table";
Expand Down
2 changes: 1 addition & 1 deletion brave/propagation-aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import brave.Tracing;
import brave.baggage.BaggageField;
import brave.internal.Nullable;
import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
import brave.propagation.TraceContext.Extractor;
Expand Down Expand Up @@ -70,11 +69,7 @@ public final class AWSPropagation implements Propagation<String> {
/** When present, this context was created with AWSPropagation */
static final AmznTraceId NO_CUSTOM_FIELDS = new AmznTraceId("");
static final Extractor<String> STRING_EXTRACTOR =
INSTANCE.extractor(new Getter<String, String>() {
@Override public String get(String request, String key) {
return request;
}
});
INSTANCE.extractor((request, key) -> request);
public static final Propagation.Factory FACTORY = new Factory();

static final char[] ROOT = "Root=".toCharArray();
Expand All @@ -87,16 +82,6 @@ static final class Factory extends Propagation.Factory {
return INSTANCE;
}

/**
* @deprecated end users and instrumentation should never call this, and instead use
* {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
// This only exists for spring-cloud-sleuth, which is no longer being released. It hasn't and
// might not upgrade to Brave 5.18 which implements the same way.
@Deprecated public <K> Propagation<K> create(KeyFactory<K> unused) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override public boolean supportsJoin() {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion collector/kinesis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion collector/sqs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>io.zipkin.aws</groupId>
<artifactId>zipkin-aws-parent</artifactId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>zipkin-module-aws</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>io.zipkin.aws</groupId>
<artifactId>zipkin-aws-parent</artifactId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down Expand Up @@ -78,8 +78,8 @@
<!-- matching armeria/grpc/zipkin -->
<zipkin.groupId>io.zipkin.zipkin2</zipkin.groupId>
<!-- when updating, update docker/Dockerfile and storage/src/test/java/zipkin2/storage/kafka/IT* -->
<zipkin.version>2.27.0</zipkin.version>
<zipkin-reporter.version>2.17.2</zipkin-reporter.version>
<zipkin.version>2.27.1</zipkin.version>
<zipkin-reporter.version>3.0.2</zipkin-reporter.version>
<spring-boot.version>2.7.18</spring-boot.version>
<jackson.version>2.16.1</jackson.version>
<!-- armeria.groupId allows you to test feature branches with jitpack -->
Expand All @@ -92,7 +92,7 @@
<!-- <brave.groupId>com.github.openzipkin.brave</brave.groupId>-->
<!-- <brave.version>master-SNAPSHOT</brave.version>-->
<brave.groupId>io.zipkin.brave</brave.groupId>
<brave.version>5.18.1</brave.version>
<brave.version>6.0.0</brave.version>

<aws-java-sdk.version>1.12.633</aws-java-sdk.version>
<sdk-core.version>2.22.13</sdk-core.version>
Expand Down
2 changes: 1 addition & 1 deletion reporter/reporter-xray-udp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion reporter/sender-awssdk-sqs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>zipkin-aws-parent</artifactId>
<groupId>io.zipkin.aws</groupId>
<version>0.24.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import java.util.Base64;
import java.util.List;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;
import zipkin2.Call;
import zipkin2.codec.Encoding;
import zipkin2.reporter.BytesMessageEncoder;
import zipkin2.reporter.Call;
import zipkin2.reporter.Encoding;
import zipkin2.reporter.Sender;

abstract class AbstractSender extends Sender {
Expand Down Expand Up @@ -74,5 +74,4 @@ int messageSizeInBytes(Encoding encoding, List<byte[]> list) {
int listSize = encoding.listSizeInBytes(list);
return (listSize + 2) * 4 / 3; // account for base64 encoding
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -17,9 +17,9 @@
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;
import software.amazon.awssdk.services.sqs.model.SendMessageResponse;
import zipkin2.Call;
import zipkin2.Callback;
import zipkin2.codec.Encoding;
import zipkin2.reporter.Call;
import zipkin2.reporter.Callback;
import zipkin2.reporter.Encoding;

public final class SQSAsyncSender extends AbstractSender {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -15,9 +15,9 @@

import software.amazon.awssdk.services.sqs.SqsClient;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;
import zipkin2.Call;
import zipkin2.Callback;
import zipkin2.codec.Encoding;
import zipkin2.reporter.Call;
import zipkin2.reporter.Callback;
import zipkin2.reporter.Encoding;

public final class SQSSender extends AbstractSender {

Expand Down
Loading

0 comments on commit 5f0f423

Please sign in to comment.