Skip to content

Commit 6c9cdeb

Browse files
authored
Fix the otel_logs_source server in how it configures authentication to also support the getHttpAuthenticationService() alternative approach. (opensearch-project#5212)
Signed-off-by: David Venable <dlv@amazon.com>
1 parent 7546062 commit 6c9cdeb

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs

data-prepper-plugins/otel-logs-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.dataprepper.plugins.source.otellogs;
77

88
import com.linecorp.armeria.common.grpc.GrpcExceptionHandlerFunction;
9+
import com.linecorp.armeria.server.HttpService;
910
import com.linecorp.armeria.server.encoding.DecodingService;
1011
import org.opensearch.dataprepper.GrpcRequestExceptionHandler;
1112
import org.opensearch.dataprepper.plugins.codec.CompressionOption;
@@ -47,8 +48,10 @@
4748
import java.time.Duration;
4849
import java.util.Collections;
4950
import java.util.List;
51+
import java.util.Optional;
5052
import java.util.concurrent.ExecutionException;
5153
import java.util.concurrent.Executors;
54+
import java.util.function.Function;
5255

5356
@DataPrepperPlugin(name = "otel_logs_source", pluginType = Source.class, pluginConfigurationType = OTelLogsSourceConfig.class)
5457
public class OTelLogsSource implements Source<Record<Object>> {
@@ -144,6 +147,13 @@ public void start(Buffer<Record<Object>> buffer) {
144147
} else {
145148
sb.service(grpcServiceBuilder.build(), DecodingService.newDecorator());
146149
}
150+
151+
if (oTelLogsSourceConfig.getAuthentication() != null) {
152+
final Optional<Function<? super HttpService, ? extends HttpService>> optionalHttpAuthenticationService =
153+
authenticationProvider.getHttpAuthenticationService();
154+
optionalHttpAuthenticationService.ifPresent(sb::decorator);
155+
}
156+
147157
sb.requestTimeoutMillis(oTelLogsSourceConfig.getRequestTimeoutInMillis());
148158
if(oTelLogsSourceConfig.getMaxRequestLength() != null) {
149159
sb.maxRequestLength(oTelLogsSourceConfig.getMaxRequestLength().getBytes());

0 commit comments

Comments
 (0)