Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish "Fix observation scope handlings in grpc server instrumentation" #3912

Merged
merged 1 commit into from
Jun 16, 2023
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
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Imports -->
<module name="IllegalImportCheck" >
<property name="id" value="GeneralIllegalImportCheck"/>
<property name="illegalPkgs" value="com.google.common.(?![cache|concurrent]).*,org.apache.commons.text.*,org.jetbrains.*,jdk.internal.jline.internal.*,reactor.util.annotation.*,org.checkerframework.checker.*,javax.ws.*"/>
<property name="illegalPkgs" value="com.google.common.(?!cache|util.concurrent).*,org.apache.commons.text.*,org.jetbrains.*,jdk.internal.jline.internal.*,reactor.util.annotation.*,org.checkerframework.checker.*,javax.ws.*"/>
<property name="illegalClasses" value="org\.assertj\.core\.api\.Java6Assertions\..*,javax.annotation.Nullable"/>
<property name="regexp" value="true"/>
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -96,12 +93,11 @@ void simulate_trace_in_async_requests() {

// Send requests asynchronously with request-id in metadata.
// The request-id is stored in threadlocal in server when scope is opened.
// The main logic retrieves the request-id from threadlocal and include it as
// The main logic retrieves the request-id from threadlocal and includes it as
// part of the response message.
// This simulates a tracer with span.
SimpleServiceFutureStub stub = SimpleServiceGrpc.newFutureStub(this.channel);
Map<ListenableFuture<SimpleResponse>, String> requestIds = new HashMap<>();
List<ListenableFuture<SimpleResponse>> futures = new ArrayList<>();
int max = 40;
for (int i = 0; i < max; i++) {
String message = "Hello-" + i;
Expand All @@ -115,8 +111,8 @@ void simulate_trace_in_async_requests() {
.unaryRpc(request);

requestIds.put(future, requestId);
futures.add(future);
}
Set<ListenableFuture<SimpleResponse>> futures = requestIds.keySet();
await().until(() -> futures.stream().allMatch(Future::isDone));
assertThat(futures).allSatisfy((future) -> {
// Make sure the request-id in the response message matches with the one sent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void onFailure(Throwable t) {

}
}, Executors.newCachedThreadPool());
futures.add(stub.unaryRpc(request));
futures.add(future);
}

await().until(() -> futures.stream().allMatch(Future::isDone));
Expand Down