Skip to content

Commit

Permalink
Updates test and optimizes collector scheduler (#3351)
Browse files Browse the repository at this point in the history
- Test
  - Junit4 4.13.1 -> 4.13.2
  - Mockito 3.6.28 -> 3.8.0
  • Loading branch information
minwoox authored Dec 3, 2023
1 parent 18102bc commit f75bf0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015-2021 The OpenZipkin Authors
Copyright 2015-2023 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 Down Expand Up @@ -85,9 +85,9 @@
<git-commit-id.version>4.0.3</git-commit-id.version>

<!-- Test only dependencies -->
<junit.version>4.13.1</junit.version>
<junit.version>4.13.2</junit.version>
<junit-jupiter.version>5.9.2</junit-jupiter.version>
<mockito.version>3.6.28</mockito.version>
<mockito.version>3.8.0</mockito.version>
<assertj.version>3.18.1</assertj.version>
<awaitility.version>4.0.3</awaitility.version>
<hamcrest.version>1.3</hamcrest.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static final class SpanService extends AbstractUnsafeUnaryGrpcService {
this.metrics = metrics;
}

@Override protected CompletionStage<ByteBuf> handleMessage(ServiceRequestContext srCtx, ByteBuf bytes) {
@Override protected CompletionStage<ByteBuf> handleMessage(ServiceRequestContext ctx, ByteBuf bytes) {
metrics.incrementMessages();
metrics.incrementBytes(bytes.readableBytes());

Expand All @@ -68,15 +68,7 @@ static final class SpanService extends AbstractUnsafeUnaryGrpcService {

try {
CompletableFutureCallback result = new CompletableFutureCallback();

// collector.accept might block so need to move off the event loop. We make sure the
// callback is context aware to continue the trace.
Executor executor = ServiceRequestContext.mapCurrent(
ctx -> ctx.makeContextAware(ctx.blockingTaskExecutor()),
CommonPools::blockingTaskExecutor);

collector.acceptSpans(bytes.nioBuffer(), SpanBytesDecoder.PROTO3, result, executor);

collector.acceptSpans(bytes.nioBuffer(), SpanBytesDecoder.PROTO3, result, ctx.blockingTaskExecutor());
return result;
} finally {
bytes.release();
Expand Down

0 comments on commit f75bf0f

Please sign in to comment.