Skip to content

Commit

Permalink
moves from Sender to BytesMessageSender (#106)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
codefromthecrypt authored Jan 15, 2024
1 parent 9bdcd4c commit 82a83ca
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.linecorp.armeria.common.brave.RequestContextCurrentTraceContext;
import java.io.IOException;
import java.util.logging.Logger;
import zipkin2.reporter.Sender;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.brave.AsyncZipkinSpanHandler;
import zipkin2.reporter.urlconnection.URLConnectionSender;

Expand Down Expand Up @@ -82,13 +82,13 @@ static Propagation.Factory propagationFactory() {
}

/** Configuration for how to send spans to Zipkin */
static Sender sender() {
static BytesMessageSender sender() {
return URLConnectionSender.create(
System.getProperty("zipkin.baseUrl", "http://127.0.0.1:9411") + "/api/v2/spans");
}

/** Configuration for how to buffer spans into messages for Zipkin */
static AsyncZipkinSpanHandler spanHandler(Sender sender) {
static AsyncZipkinSpanHandler spanHandler(BytesMessageSender sender) {
final AsyncZipkinSpanHandler spanHandler = AsyncZipkinSpanHandler.create(sender);

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import io.netty.channel.ChannelHandler;
import java.io.IOException;
import java.util.logging.Logger;
import zipkin2.reporter.Sender;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.brave.AsyncZipkinSpanHandler;
import zipkin2.reporter.urlconnection.URLConnectionSender;

Expand Down Expand Up @@ -94,13 +94,13 @@ static Propagation.Factory propagationFactory() {
}

/** Configuration for how to send spans to Zipkin */
static Sender sender() {
static BytesMessageSender sender() {
return URLConnectionSender.create(
System.getProperty("zipkin.baseUrl", "http://127.0.0.1:9411") + "/api/v2/spans");
}

/** Configuration for how to buffer spans into messages for Zipkin */
static AsyncZipkinSpanHandler spanHandler(Sender sender) {
static AsyncZipkinSpanHandler spanHandler(BytesMessageSender sender) {
final AsyncZipkinSpanHandler spanHandler = AsyncZipkinSpanHandler.create(sender);

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import zipkin2.reporter.Sender;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.brave.AsyncZipkinSpanHandler;
import zipkin2.reporter.okhttp3.OkHttpSender;

Expand Down Expand Up @@ -60,13 +60,13 @@ public class TracingAutoConfiguration {
}

/** Configuration for how to send spans to Zipkin */
@Bean Sender sender(
@Bean BytesMessageSender sender(
@Value("${zipkin.baseUrl:http://127.0.0.1:9411}/api/v2/spans") String zipkinEndpoint) {
return OkHttpSender.create(zipkinEndpoint);
}

/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncZipkinSpanHandler zipkinSpanHandler(Sender sender) {
@Bean AsyncZipkinSpanHandler zipkinSpanHandler(BytesMessageSender sender) {
return AsyncZipkinSpanHandler.create(sender);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import zipkin2.reporter.Sender;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.brave.AsyncZipkinSpanHandler;
import zipkin2.reporter.okhttp3.OkHttpSender;

Expand Down Expand Up @@ -65,13 +65,13 @@ public class TracingConfiguration {
}

/** Configuration for how to send spans to Zipkin */
@Bean Sender sender(
@Bean BytesMessageSender sender(
@Value("${zipkin.baseUrl:http://127.0.0.1:9411}/api/v2/spans") String zipkinEndpoint) {
return OkHttpSender.create(zipkinEndpoint);
}

/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncZipkinSpanHandler zipkinSpanHandler(Sender sender) {
@Bean AsyncZipkinSpanHandler zipkinSpanHandler(BytesMessageSender sender) {
return AsyncZipkinSpanHandler.create(sender);
}

Expand Down

0 comments on commit 82a83ca

Please sign in to comment.