From 349612a733c22d7201566111c85b504fd73e8dcb Mon Sep 17 00:00:00 2001 From: qchea Date: Wed, 6 Oct 2021 14:21:31 -0500 Subject: [PATCH] MAINT: add default retry rule for Armeria client Signed-off-by: qchea --- .../dataprepper/integration/EndToEndRawSpanTest.java | 8 ++++++-- .../dataprepper/integration/EndToEndServiceMapTest.java | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndRawSpanTest.java b/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndRawSpanTest.java index 07594f8336..2b15a59316 100644 --- a/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndRawSpanTest.java +++ b/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndRawSpanTest.java @@ -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; @@ -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())) + .build(TraceServiceGrpc.TraceServiceBlockingStub.class); + client.export(request); } private List> getSourcesFromSearchHits(final SearchHits searchHits) { diff --git a/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndServiceMapTest.java b/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndServiceMapTest.java index 3dc44acd93..e30487ca66 100644 --- a/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndServiceMapTest.java +++ b/data-prepper-core/src/integrationTest/java/com/amazon/dataprepper/integration/EndToEndServiceMapTest.java @@ -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; @@ -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> getSourcesFromIndex(final RestHighLevelClient restHighLevelClient, final String index) throws IOException {