From edd221411da64ac59938ac5cebae611a26953033 Mon Sep 17 00:00:00 2001 From: David Venable Date: Thu, 21 Nov 2024 15:42:12 -0600 Subject: [PATCH] Fix the otel_logs_source server in how it configures authentication to also support the getHttpAuthenticationService() alternative approach. Signed-off-by: David Venable --- .../plugins/source/otellogs/OTelLogsSource.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java b/data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java index bbe06ae06e..5e6a36490c 100644 --- a/data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java +++ b/data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java @@ -6,6 +6,7 @@ package org.opensearch.dataprepper.plugins.source.otellogs; import com.linecorp.armeria.common.grpc.GrpcExceptionHandlerFunction; +import com.linecorp.armeria.server.HttpService; import com.linecorp.armeria.server.encoding.DecodingService; import org.opensearch.dataprepper.GrpcRequestExceptionHandler; import org.opensearch.dataprepper.plugins.codec.CompressionOption; @@ -47,8 +48,10 @@ import java.time.Duration; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; +import java.util.function.Function; @DataPrepperPlugin(name = "otel_logs_source", pluginType = Source.class, pluginConfigurationType = OTelLogsSourceConfig.class) public class OTelLogsSource implements Source> { @@ -144,6 +147,13 @@ public void start(Buffer> buffer) { } else { sb.service(grpcServiceBuilder.build(), DecodingService.newDecorator()); } + + if (oTelLogsSourceConfig.getAuthentication() != null) { + final Optional> optionalHttpAuthenticationService = + authenticationProvider.getHttpAuthenticationService(); + optionalHttpAuthenticationService.ifPresent(sb::decorator); + } + sb.requestTimeoutMillis(oTelLogsSourceConfig.getRequestTimeoutInMillis()); if(oTelLogsSourceConfig.getMaxRequestLength() != null) { sb.maxRequestLength(oTelLogsSourceConfig.getMaxRequestLength().getBytes());