Skip to content

Commit

Permalink
Fix the otel_logs_source server in how it configures authentication t…
Browse files Browse the repository at this point in the history
…o also support the getHttpAuthenticationService() alternative approach. (opensearch-project#5212)

Signed-off-by: David Venable <[email protected]>
  • Loading branch information
dlvenable authored Nov 21, 2024
1 parent 7546062 commit 6c9cdeb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Record<Object>> {
Expand Down Expand Up @@ -144,6 +147,13 @@ public void start(Buffer<Record<Object>> buffer) {
} else {
sb.service(grpcServiceBuilder.build(), DecodingService.newDecorator());
}

if (oTelLogsSourceConfig.getAuthentication() != null) {
final Optional<Function<? super HttpService, ? extends HttpService>> optionalHttpAuthenticationService =
authenticationProvider.getHttpAuthenticationService();
optionalHttpAuthenticationService.ifPresent(sb::decorator);
}

sb.requestTimeoutMillis(oTelLogsSourceConfig.getRequestTimeoutInMillis());
if(oTelLogsSourceConfig.getMaxRequestLength() != null) {
sb.maxRequestLength(oTelLogsSourceConfig.getMaxRequestLength().getBytes());
Expand Down

0 comments on commit 6c9cdeb

Please sign in to comment.