You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zipkin.apache.org by ad...@apache.org on 2019/05/10 01:06:28 UTC
[incubator-zipkin] branch master updated: Polishes scribe module
(#2575)
This is an automated email from the ASF dual-hosted git repository.
adriancole pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin.git
The following commit(s) were added to refs/heads/master by this push:
new 4854ae5 Polishes scribe module (#2575)
4854ae5 is described below
commit 4854ae53ef77da4060813fd199c8e0e4f758d5ce
Author: Adrian Cole <ad...@users.noreply.github.com>
AuthorDate: Fri May 10 09:06:23 2019 +0800
Polishes scribe module (#2575)
This fixes the maven configuration of scribe resulting in a module jar
less than half a meg. Besides reformatting files, it fixes a couple
glitches: `Unknown channel option 'SO_BACKLOG'` in logs, and some areas
where fatal errors weren't propagated (however unlikely).
Tested under load with no errors or dropped messages.
---
zipkin-autoconfigure/collector-scribe/README.md | 5 +-
zipkin-autoconfigure/collector-scribe/pom.xml | 70 +++++-----------------
...ZipkinScribeCollectorAutoConfigurationTest.java | 54 +++++++----------
.../collector/scribe/NettyScribeServer.java | 15 +++--
.../zipkin2/collector/scribe/ScribeCollector.java | 21 +++----
.../collector/scribe/ScribeInboundHandler.java | 42 ++++++-------
.../collector/scribe/ScribeSpanConsumer.java | 25 ++++----
.../collector/scribe/ITScribeCollector.java | 9 +--
.../collector/scribe/ScribeCollectorTest.java | 11 ++--
.../collector/scribe/ScribeSpanConsumerTest.java | 64 +++++++++-----------
10 files changed, 116 insertions(+), 200 deletions(-)
diff --git a/zipkin-autoconfigure/collector-scribe/README.md b/zipkin-autoconfigure/collector-scribe/README.md
index 982c882..5cb0ba9 100644
--- a/zipkin-autoconfigure/collector-scribe/README.md
+++ b/zipkin-autoconfigure/collector-scribe/README.md
@@ -2,9 +2,8 @@
This module provides support for running the legacy Scribe collector as
a component of Zipkin server. To activate this collector, reference the
-module jar when running the Zipkin server and configure one or more
-bootstrap brokers via the `SCRIBE_ENABLED=true` environment variable or
-the property `zipkin.collector.scribe.enabled=true`.
+module jar when running the Zipkin server set the `SCRIBE_ENABLED=true`
+environment variable or property `zipkin.collector.scribe.enabled=true`.
## Quick start
diff --git a/zipkin-autoconfigure/collector-scribe/pom.xml b/zipkin-autoconfigure/collector-scribe/pom.xml
index d0adc1b..9fa4967 100644
--- a/zipkin-autoconfigure/collector-scribe/pom.xml
+++ b/zipkin-autoconfigure/collector-scribe/pom.xml
@@ -17,7 +17,9 @@
limitations under 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>
<parent>
@@ -38,15 +40,6 @@
<groupId>${project.groupId}.zipkin2</groupId>
<artifactId>zipkin-collector-scribe</artifactId>
<version>${project.version}</version>
- <exclusions>
- <!-- com.facebook.swift:swift-service brings an old version which
- leads to javax.validation.ValidationException. Exclude it!
- -->
- <exclusion>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </exclusion>
- </exclusions>
</dependency>
</dependencies>
@@ -61,22 +54,20 @@
<name>zipkin</name>
</layoutFactory>
<classifier>module</classifier>
- <!-- exclude dependencies already packaged in zipkin-server -->
- <!-- https://github.com/spring-projects/spring-boot/issues/3426 transitive exclude doesn't work -->
- <excludeGroupIds>
- org.springframework.boot,org.springframework,org.slf4j,commons-logging,com.google.code.gson,com.google.guava
- </excludeGroupIds>
- <!-- excludes direct dependency instead of the group id, as otherwise we'd exclude ourselves -->
- <excludes>
- <exclude>
+ <includes>
+ <dependency>
<groupId>${project.groupId}.zipkin2</groupId>
- <artifactId>zipkin</artifactId>
- </exclude>
- <exclude>
- <groupId>${project.groupId}.zipkin2</groupId>
- <artifactId>zipkin-collector</artifactId>
- </exclude>
- </excludes>
+ <artifactId>zipkin-collector-scribe</artifactId>
+ </dependency>
+ <include>
+ <groupId>com.linecorp.armeria</groupId>
+ <artifactId>armeria-thrift</artifactId>
+ </include>
+ <include>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </include>
+ </includes>
</configuration>
<dependencies>
<dependency>
@@ -88,33 +79,4 @@
</plugin>
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>jigsaw</id>
- <activation>
- <jdk>[1.9,)</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <!-- we cannot use rat until RAT-239 is fixed, as it fails when forkCount=0 -->
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <!-- to prevent class not found in tests -->
- <configuration>
- <forkCount>0</forkCount>
- <argLine>--add-modules java.xml.bind</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git a/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java b/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java
index bd99895..c8994d2 100644
--- a/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java
+++ b/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java
@@ -38,22 +38,17 @@ public class ZipkinScribeCollectorAutoConfigurationTest {
@Rule public ExpectedException thrown = ExpectedException.none();
- AnnotationConfigApplicationContext context;
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
- @After
- public void close() {
- if (context != null) {
- context.close();
- }
+ @After public void close() {
+ context.close();
}
- @Test
- public void doesntProvidesCollectorComponent_byDefault() {
- context = new AnnotationConfigApplicationContext();
+ @Test public void doesntProvidesCollectorComponent_byDefault() {
context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
+ PropertyPlaceholderAutoConfiguration.class,
+ ZipkinScribeCollectorAutoConfiguration.class,
+ InMemoryConfiguration.class);
context.refresh();
thrown.expect(NoSuchBeanDefinitionException.class);
@@ -61,30 +56,26 @@ public class ZipkinScribeCollectorAutoConfigurationTest {
}
/** Note: this will flake if you happen to be running a server on port 9410! */
- @Test
- public void providesCollectorComponent_whenEnabled() {
- context = new AnnotationConfigApplicationContext();
+ @Test public void providesCollectorComponent_whenEnabled() {
TestPropertyValues.of("zipkin.collector.scribe.enabled:true").applyTo(context);
context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
+ PropertyPlaceholderAutoConfiguration.class,
+ ZipkinScribeCollectorAutoConfiguration.class,
+ InMemoryConfiguration.class);
context.refresh();
assertThat(context.getBean(ScribeCollector.class)).isNotNull();
}
- @Test
- public void canOverrideProperty_port() {
- context = new AnnotationConfigApplicationContext();
+ @Test public void canOverrideProperty_port() {
TestPropertyValues.of(
- "zipkin.collector.scribe.enabled:true",
- "zipkin.collector.scribe.port:9999")
- .applyTo(context);
+ "zipkin.collector.scribe.enabled:true",
+ "zipkin.collector.scribe.port:9999")
+ .applyTo(context);
context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
+ PropertyPlaceholderAutoConfiguration.class,
+ ZipkinScribeCollectorAutoConfiguration.class,
+ InMemoryConfiguration.class);
context.refresh();
assertThat(context.getBean(ZipkinScribeCollectorProperties.class).getPort()).isEqualTo(9999);
@@ -92,18 +83,15 @@ public class ZipkinScribeCollectorAutoConfigurationTest {
@Configuration
static class InMemoryConfiguration {
- @Bean
- CollectorSampler sampler() {
+ @Bean CollectorSampler sampler() {
return CollectorSampler.ALWAYS_SAMPLE;
}
- @Bean
- CollectorMetrics metrics() {
+ @Bean CollectorMetrics metrics() {
return CollectorMetrics.NOOP_METRICS;
}
- @Bean
- StorageComponent storage() {
+ @Bean StorageComponent storage() {
return InMemoryStorage.newBuilder().build();
}
}
diff --git a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/NettyScribeServer.java b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/NettyScribeServer.java
index 009150e..5018be3 100644
--- a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/NettyScribeServer.java
+++ b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/NettyScribeServer.java
@@ -21,15 +21,16 @@ import com.linecorp.armeria.common.util.EventLoopGroups;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import java.net.InetSocketAddress;
-class NettyScribeServer {
+import static zipkin2.Call.propagateIfFatal;
- private final int port;
- private final ScribeSpanConsumer scribe;
+final class NettyScribeServer {
+
+ final int port;
+ final ScribeSpanConsumer scribe;
volatile EventLoopGroup bossGroup;
volatile Channel channel;
@@ -48,17 +49,15 @@ class NettyScribeServer {
channel = b.group(bossGroup, workerGroup)
.channel(EventLoopGroups.serverChannelType(bossGroup))
.childHandler(new ChannelInitializer<SocketChannel>() {
- @Override
- protected void initChannel(SocketChannel ch) {
+ @Override protected void initChannel(SocketChannel ch) {
ch.pipeline().addLast(new ScribeInboundHandler(scribe));
}
})
- // Uses same value as the previously used swift library for consistency.
- .childOption(ChannelOption.SO_BACKLOG, 1024)
.bind(port)
.syncUninterruptibly()
.channel();
} catch (Throwable t) {
+ propagateIfFatal(t);
throw new RuntimeException("Could not start scribe server.", t);
}
}
diff --git a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeCollector.java b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeCollector.java
index 7d72bf3..abfffe1 100644
--- a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeCollector.java
+++ b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeCollector.java
@@ -42,22 +42,19 @@ public final class ScribeCollector extends CollectorComponent {
String category = "zipkin";
int port = 9410;
- @Override
- public Builder storage(StorageComponent storage) {
+ @Override public Builder storage(StorageComponent storage) {
delegate.storage(storage);
return this;
}
- @Override
- public Builder metrics(CollectorMetrics metrics) {
+ @Override public Builder metrics(CollectorMetrics metrics) {
if (metrics == null) throw new NullPointerException("metrics == null");
this.metrics = metrics.forTransport("scribe");
delegate.metrics(this.metrics);
return this;
}
- @Override
- public Builder sampler(CollectorSampler sampler) {
+ @Override public Builder sampler(CollectorSampler sampler) {
delegate.sampler(sampler);
return this;
}
@@ -75,8 +72,7 @@ public final class ScribeCollector extends CollectorComponent {
return this;
}
- @Override
- public ScribeCollector build() {
+ @Override public ScribeCollector build() {
return new ScribeCollector(this);
}
}
@@ -89,22 +85,19 @@ public final class ScribeCollector extends CollectorComponent {
}
/** Will throw an exception if the {@link Builder#port(int) port} is already in use. */
- @Override
- public ScribeCollector start() {
+ @Override public ScribeCollector start() {
server.start();
return this;
}
- @Override
- public CheckResult check() {
+ @Override public CheckResult check() {
if (!server.isRunning()) {
return CheckResult.failed(new IllegalStateException("server not running"));
}
return CheckResult.OK;
}
- @Override
- public void close() {
+ @Override public void close() {
server.close();
}
}
diff --git a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeInboundHandler.java b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeInboundHandler.java
index 465809b..ef11a63 100644
--- a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeInboundHandler.java
+++ b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeInboundHandler.java
@@ -42,7 +42,9 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
+import static zipkin2.Call.propagateIfFatal;
+
+final class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
static final Logger logger = LoggerFactory.getLogger(ScribeInboundHandler.class);
@@ -73,18 +75,13 @@ class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
int nextResponseIndex = 0;
int previouslySentResponseIndex = -1;
- @Override
- public void channelActive(ChannelHandlerContext ctx) throws Exception {
+ @Override public void channelActive(ChannelHandlerContext ctx) {
pending = ctx.alloc().compositeBuffer();
state = ReadState.HEADER;
}
- @Override
- public void channelRead(final ChannelHandlerContext ctx, Object msg) {
- if (pending == null) {
- // Already closed (probably due to an exception).
- return;
- }
+ @Override public void channelRead(final ChannelHandlerContext ctx, Object msg) {
+ if (pending == null) return; // Already closed (probably due to an exception).
assert msg instanceof ByteBuf;
ByteBuf buf = (ByteBuf) msg;
@@ -100,13 +97,11 @@ class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
}
}
- @Override
- public void channelInactive(ChannelHandlerContext ctx) {
+ @Override public void channelInactive(ChannelHandlerContext ctx) {
release();
}
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
+ @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
Exceptions.logIfUnexpected(logger, ctx.channel(), cause);
release();
@@ -114,18 +109,15 @@ class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
}
void maybeReadHeader(ChannelHandlerContext ctx) {
- if (pending.readableBytes() < 4) {
- return;
- }
+ if (pending.readableBytes() < 4) return;
+
nextFrameSize = pending.readInt();
state = ReadState.PAYLOAD;
maybeReadPayload(ctx);
}
void maybeReadPayload(ChannelHandlerContext ctx) {
- if (pending.readableBytes() < nextFrameSize) {
- return;
- }
+ if (pending.readableBytes() < nextFrameSize) return;
ByteBuf payload = ctx.alloc().buffer(nextFrameSize);
pending.readBytes(payload, nextFrameSize);
@@ -133,9 +125,8 @@ class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
state = ReadState.HEADER;
- HttpRequest request = HttpRequest.of(
- THRIFT_HEADERS.toMutable(),
- new ByteBufHttpData(payload, true));
+ HttpRequest request =
+ HttpRequest.of(THRIFT_HEADERS.toMutable(), new ByteBufHttpData(payload, true));
ServiceRequestContextBuilder requestContextBuilder = ServiceRequestContextBuilder.of(request)
.service(scribeService)
.alloc(ctx.alloc());
@@ -147,10 +138,11 @@ class ScribeInboundHandler extends ChannelInboundHandlerAdapter {
ServiceRequestContext requestContext = requestContextBuilder.build();
final HttpResponse response;
- try (SafeCloseable unused = requestContext.push()){
+ try (SafeCloseable unused = requestContext.push()) {
response = scribeService.serve(requestContext, request);
- } catch (Exception e) {
- exceptionCaught(ctx, e);
+ } catch (Throwable t) {
+ propagateIfFatal(t);
+ exceptionCaught(ctx, t);
return;
}
diff --git a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeSpanConsumer.java b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeSpanConsumer.java
index 35ea7dc..e043be9 100644
--- a/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeSpanConsumer.java
+++ b/zipkin-collector/scribe/src/main/java/zipkin2/collector/scribe/ScribeSpanConsumer.java
@@ -29,9 +29,8 @@ import zipkin2.collector.CollectorMetrics;
import zipkin2.collector.scribe.generated.LogEntry;
import zipkin2.collector.scribe.generated.ResultCode;
import zipkin2.collector.scribe.generated.Scribe;
-import zipkin2.internal.Nullable;
-class ScribeSpanConsumer implements Scribe.AsyncIface {
+final class ScribeSpanConsumer implements Scribe.AsyncIface {
final Collector collector;
final CollectorMetrics metrics;
final String category;
@@ -63,19 +62,15 @@ class ScribeSpanConsumer implements Scribe.AsyncIface {
metrics.incrementBytes(byteCount);
}
- collector.accept(
- spans,
- new Callback<Void>() {
- @Override
- public void onSuccess(@Nullable Void value) {
- resultHandler.onComplete(ResultCode.OK);
- }
+ collector.accept(spans, new Callback<Void>() {
+ @Override public void onSuccess(Void value) {
+ resultHandler.onComplete(ResultCode.OK);
+ }
- @Override
- public void onError(Throwable t) {
- Exception error = t instanceof Exception ? (Exception) t : new RuntimeException(t);
- resultHandler.onError(error);
- }
- });
+ @Override public void onError(Throwable t) {
+ Exception error = t instanceof Exception ? (Exception) t : new RuntimeException(t);
+ resultHandler.onError(error);
+ }
+ });
}
}
diff --git a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ITScribeCollector.java b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ITScribeCollector.java
index 8274cc1..939219f 100644
--- a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ITScribeCollector.java
+++ b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ITScribeCollector.java
@@ -53,8 +53,7 @@ public class ITScribeCollector {
private static NettyScribeServer server;
- @BeforeClass
- public static void startServer() {
+ @BeforeClass public static void startServer() {
collector = mock(Collector.class);
doAnswer(invocation -> {
Callback<Void> callback = invocation.getArgument(1);
@@ -68,13 +67,11 @@ public class ITScribeCollector {
server.start();
}
- @AfterClass
- public static void stopServer() {
+ @AfterClass public static void stopServer() {
server.close();
}
- @Test
- public void normal() throws Exception {
+ @Test public void normal() throws Exception {
// Java version of this sample code
// https://github.com/facebookarchive/scribe/wiki/Logging-Messages
TTransport transport = new TFramedTransport(new TSocket("localhost", server.port()));
diff --git a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeCollectorTest.java b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeCollectorTest.java
index ca53997..a725b2f 100644
--- a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeCollectorTest.java
+++ b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeCollectorTest.java
@@ -28,10 +28,9 @@ public class ScribeCollectorTest {
InMemoryStorage storage = InMemoryStorage.newBuilder().build();
@Rule public ExpectedException thrown = ExpectedException.none();
- @Test
- public void check_failsWhenNotStarted() {
+ @Test public void check_failsWhenNotStarted() {
try (ScribeCollector scribe =
- ScribeCollector.newBuilder().storage(storage).port(12345).build()) {
+ ScribeCollector.newBuilder().storage(storage).port(12345).build()) {
CheckResult result = scribe.check();
assertThat(result.ok()).isFalse();
@@ -42,15 +41,15 @@ public class ScribeCollectorTest {
}
}
- @Test
- public void start_failsWhenCantBindPort() {
+ @Test public void start_failsWhenCantBindPort() {
thrown.expect(RuntimeException.class);
thrown.expectMessage("Could not start scribe server.");
ScribeCollector.Builder builder = ScribeCollector.newBuilder().storage(storage).port(12345);
try (ScribeCollector first = builder.build().start()) {
- try (ScribeCollector samePort = builder.build().start()) {}
+ try (ScribeCollector samePort = builder.build().start()) {
+ }
}
}
}
diff --git a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeSpanConsumerTest.java b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeSpanConsumerTest.java
index fdea0bc..fb00c05 100644
--- a/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeSpanConsumerTest.java
+++ b/zipkin-collector/scribe/src/test/java/zipkin2/collector/scribe/ScribeSpanConsumerTest.java
@@ -70,34 +70,32 @@ public class ScribeSpanConsumerTest {
}
Endpoint zipkinQuery =
- Endpoint.newBuilder().serviceName("zipkin-query").ip("127.0.0.1").port(9411).build();
+ Endpoint.newBuilder().serviceName("zipkin-query").ip("127.0.0.1").port(9411).build();
Endpoint zipkinQuery0 = zipkinQuery.toBuilder().port(null).build();
- V1Span v1 =
- V1Span.newBuilder()
- .traceId(-6054243957716233329L)
- .name("getTracesByIds")
- .id(-3615651937927048332L)
- .parentId(-6054243957716233329L)
- .addAnnotation(1442493420635000L, "sr", zipkinQuery)
- .addAnnotation(1442493420747000L, reallyLongAnnotation, zipkinQuery)
- .addAnnotation(
- 1442493422583586L,
- "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)",
- zipkinQuery)
- .addAnnotation(1442493422680000L, "ss", zipkinQuery)
- .addBinaryAnnotation("srv/finagle.version", "6.28.0", zipkinQuery0)
- .addBinaryAnnotation("sa", zipkinQuery)
- .addBinaryAnnotation("ca", zipkinQuery.toBuilder().port(63840).build())
- .debug(false)
- .build();
+ V1Span v1 = V1Span.newBuilder()
+ .traceId(-6054243957716233329L)
+ .name("getTracesByIds")
+ .id(-3615651937927048332L)
+ .parentId(-6054243957716233329L)
+ .addAnnotation(1442493420635000L, "sr", zipkinQuery)
+ .addAnnotation(1442493420747000L, reallyLongAnnotation, zipkinQuery)
+ .addAnnotation(
+ 1442493422583586L,
+ "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)",
+ zipkinQuery)
+ .addAnnotation(1442493422680000L, "ss", zipkinQuery)
+ .addBinaryAnnotation("srv/finagle.version", "6.28.0", zipkinQuery0)
+ .addBinaryAnnotation("sa", zipkinQuery)
+ .addBinaryAnnotation("ca", zipkinQuery.toBuilder().port(63840).build())
+ .debug(false)
+ .build();
Span v2 = V1SpanConverter.create().convert(v1).get(0);
byte[] bytes = SpanBytesEncoder.THRIFT.encode(v2);
String encodedSpan = new String(Base64.getEncoder().encode(bytes), UTF_8);
- @Test
- public void entriesWithSpansAreConsumed() throws Exception {
+ @Test public void entriesWithSpansAreConsumed() {
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
@@ -115,8 +113,7 @@ public class ScribeSpanConsumerTest {
assertThat(scribeMetrics.spansDropped()).isZero();
}
- @Test
- public void entriesWithoutSpansAreSkipped() throws Exception {
+ @Test public void entriesWithoutSpansAreSkipped() {
SpanConsumer consumer = (callback) -> {
throw new AssertionError(); // as we shouldn't get here.
};
@@ -142,8 +139,7 @@ public class ScribeSpanConsumerTest {
assertThat(callback.resultCode).isEqualTo(ResultCode.OK);
}
- @Test
- public void malformedDataIsDropped() throws Exception {
+ @Test public void malformedDataIsDropped() {
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
@@ -161,8 +157,7 @@ public class ScribeSpanConsumerTest {
assertThat(scribeMetrics.spansDropped()).isZero();
}
- @Test
- public void consumerExceptionBeforeCallbackSetsFutureException() throws Exception {
+ @Test public void consumerExceptionBeforeCallbackSetsFutureException() {
consumer = (input) -> {
throw new NullPointerException("endpoint was null");
};
@@ -188,8 +183,7 @@ public class ScribeSpanConsumerTest {
* Callbacks are performed asynchronously. If they throw, it hints that we are chaining futures
* when we shouldn't
*/
- @Test
- public void callbackExceptionDoesntThrow() throws Exception {
+ @Test public void callbackExceptionDoesntThrow() {
consumer = (input) -> new Call.Base<Void>() {
@Override protected Void doExecute() {
throw new AssertionError();
@@ -199,8 +193,7 @@ public class ScribeSpanConsumerTest {
callback.onError(new NullPointerException());
}
- @Override
- public Call<Void> clone() {
+ @Override public Call<Void> clone() {
throw new AssertionError();
}
};
@@ -221,13 +214,12 @@ public class ScribeSpanConsumerTest {
}
/** Finagle's zipkin tracer breaks on a column width with a trailing newline */
- @Test
- public void decodesSpanGeneratedByFinagle() throws Exception {
+ @Test public void decodesSpanGeneratedByFinagle() throws Exception {
LogEntry entry = new LogEntry();
entry.category = "zipkin";
- entry.message =
- "CgABq/sBMnzE048LAAMAAAAOZ2V0VHJhY2VzQnlJZHMKAATN0p+4EGfTdAoABav7ATJ8xNOPDwAGDAAAAAQKAAEABR/wq+2DeAsAAgAAAAJzcgwAAwgAAX8AAAEGAAIkwwsAAwAAAAx6aXBraW4tcXVlcnkAAAoAAQAFH/Cr7zj4CwACAAAIAGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY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