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 <dlv@amazon.com>
(cherry picked from commit 6c9cdeb)
  • Loading branch information
dlvenable committed Nov 25, 2024
1 parent 9b455a5 commit 7fc2401
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.opensearch.dataprepper.plugins.source.otellogs;

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 @@ -45,8 +46,10 @@
import java.nio.charset.StandardCharsets;
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 @@ -141,6 +144,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 7fc2401

Please sign in to comment.