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

MAINT: add default retry rule for Armeria client in End-to-end tests #375

Merged
merged 1 commit into from
Oct 6, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.protobuf.ByteString;
import com.linecorp.armeria.client.Clients;
import com.linecorp.armeria.client.retry.RetryRule;
import com.linecorp.armeria.client.retry.RetryingClient;
import com.linecorp.armeria.internal.shaded.bouncycastle.util.encoders.Hex;
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc;
Expand Down Expand Up @@ -152,8 +154,10 @@ private void refreshIndices(final RestHighLevelClient restHighLevelClient) throw
}

private void sendExportTraceServiceRequestToSource(final int port, final ExportTraceServiceRequest request) {
Clients.newClient(String.format("gproto+http://127.0.0.1:%d/", port),
TraceServiceGrpc.TraceServiceBlockingStub.class).export(request);
TraceServiceGrpc.TraceServiceBlockingStub client = Clients.builder(String.format("gproto+http://127.0.0.1:%d/", port))
.decorator(RetryingClient.newDecorator(RetryRule.failsafe()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change overall!

The documentation on this wasn't clear regarding how many times it tries. Is this limited?
If we are unsure as to the number of retries, we should be sure that the test itself has a JUnit @Timeout.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.build(TraceServiceGrpc.TraceServiceBlockingStub.class);
client.export(request);
}

private List<Map<String, Object>> getSourcesFromSearchHits(final SearchHits searchHits) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.stream.Stream;

import com.linecorp.armeria.client.Clients;
import com.linecorp.armeria.client.retry.RetryRule;
import com.linecorp.armeria.client.retry.RetryingClient;
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc;
import io.opentelemetry.proto.common.v1.AnyValue;
Expand Down Expand Up @@ -132,8 +134,10 @@ private void refreshIndices(final RestHighLevelClient restHighLevelClient) throw
}

private void sendExportTraceServiceRequestToSource(final int port, final ExportTraceServiceRequest request) {
Clients.newClient(String.format("gproto+http://127.0.0.1:%d/", port),
TraceServiceGrpc.TraceServiceBlockingStub.class).export(request);
TraceServiceGrpc.TraceServiceBlockingStub client = Clients.builder(String.format("gproto+http://127.0.0.1:%d/", port))
.decorator(RetryingClient.newDecorator(RetryRule.failsafe()))
.build(TraceServiceGrpc.TraceServiceBlockingStub.class);
client.export(request);
}

private List<Map<String, Object>> getSourcesFromIndex(final RestHighLevelClient restHighLevelClient, final String index) throws IOException {
Expand Down