Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethrow exception in writeData() #943

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ static void recordLatency(String metricNamePrefix, long latencyMilliseconds) {
* Otherwise, it increments a general failure metric counter based on the status code category (e.g., 4xx, 5xx).
*
* @param metricNamePrefix the prefix for the metric name which is used to construct the full metric name for failure
* @param e the exception encountered during the operation, used to determine the type of failure
* @param t the exception encountered during the operation, used to determine the type of failure
*/
static void recordOperationFailure(String metricNamePrefix, Exception e) {
OpenSearchException openSearchException = extractOpenSearchException(e);
static void recordOperationFailure(String metricNamePrefix, Throwable t) {
OpenSearchException openSearchException = extractOpenSearchException(t);
int statusCode = openSearchException != null ? openSearchException.status().getStatus() : 500;
if (openSearchException != null) {
CustomLogging.logError(new OperationMessage("OpenSearch Operation failed.", statusCode), openSearchException);
} else {
CustomLogging.logError("OpenSearch Operation failed with an exception.", e);
CustomLogging.logError("OpenSearch Operation failed with an exception.", t);
}
if (statusCode == 403) {
String forbiddenErrorMetricName = metricNamePrefix + ".403.count";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ trait FlintJobExecutor {
IRestHighLevelClient.recordOperationSuccess(
MetricConstants.RESULT_METADATA_WRITE_METRIC_PREFIX)
} catch {
case e: Exception =>
case t: Throwable =>
IRestHighLevelClient.recordOperationFailure(
MetricConstants.RESULT_METADATA_WRITE_METRIC_PREFIX,
e)
t)
// Re-throw the exception
throw t
}
}

Expand Down
Loading