Skip to content

Commit

Permalink
Update gRPC and HTTP logging
Browse files Browse the repository at this point in the history
Signed-off-by: Asif Sohail Mohammed <[email protected]>
  • Loading branch information
asifsmohammed committed Nov 14, 2023
1 parent 88e0bb0 commit 0c45937
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
import org.opensearch.dataprepper.exceptions.RequestCancelledException;
import org.opensearch.dataprepper.metrics.PluginMetrics;
import org.opensearch.dataprepper.model.buffer.SizeOverflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeoutException;

public class GrpcRequestExceptionHandler implements GrpcStatusFunction {
private static final Logger LOG = LoggerFactory.getLogger(GrpcRequestExceptionHandler.class);
static final String ARMERIA_REQUEST_TIMEOUT_MESSAGE = "Timeout waiting for request to be served. This is usually due to the buffer being full.";

public static final String REQUEST_TIMEOUTS = "requestTimeouts";
Expand Down Expand Up @@ -63,6 +66,7 @@ private Status handleExceptions(final Throwable e) {
}

internalServerErrorCounter.increment();
LOG.error("Unexpected exception handling gRPC request", e);
return createStatus(e, Status.INTERNAL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
import com.linecorp.armeria.common.HttpStatus;
import com.linecorp.armeria.common.MediaType;
import io.micrometer.core.instrument.Counter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class HttpRequestExceptionHandler implements ExceptionHandlerFunction {
private static final Logger LOG = LoggerFactory.getLogger(HttpRequestExceptionHandler.class);
static final String ARMERIA_REQUEST_TIMEOUT_MESSAGE = "Timeout waiting for request to be served. This is usually due to the buffer being full.";

public static final String REQUEST_TIMEOUTS = "requestTimeouts";
Expand Down Expand Up @@ -65,6 +68,7 @@ private HttpStatus handleException(final Throwable e) {
}

internalServerErrorCounter.increment();
LOG.error("Unexpected exception handling HTTP request", e);
return HttpStatus.INTERNAL_SERVER_ERROR;
}
}

0 comments on commit 0c45937

Please sign in to comment.