-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error handling strategy to pull-based ingestion
Signed-off-by: Varun Bharadwaj <[email protected]>
- Loading branch information
1 parent
0714a1b
commit 7eee397
Showing
14 changed files
with
404 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
server/src/main/java/org/opensearch/indices/pollingingest/BlockIngestionErrorStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.pollingingest; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
/** | ||
* This error handling strategy blocks on failures preventing processing of remaining updates in the ingestion source. | ||
*/ | ||
public class BlockIngestionErrorStrategy implements IngestionErrorStrategy { | ||
private static final Logger logger = LogManager.getLogger(BlockIngestionErrorStrategy.class); | ||
private final String ingestionSource; | ||
|
||
public BlockIngestionErrorStrategy(String ingestionSource) { | ||
this.ingestionSource = ingestionSource; | ||
} | ||
|
||
@Override | ||
public void handleError(Throwable e, ErrorStage stage) { | ||
logger.error("Error processing update from {}: {}", ingestionSource, e); | ||
|
||
// todo: record blocking update and emit metrics | ||
} | ||
|
||
@Override | ||
public boolean shouldPauseIngestion(Throwable e, ErrorStage stage) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
server/src/main/java/org/opensearch/indices/pollingingest/DropIngestionErrorStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.pollingingest; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
/** | ||
* This error handling strategy drops failures and proceeds with remaining updates in the ingestion source. | ||
*/ | ||
public class DropIngestionErrorStrategy implements IngestionErrorStrategy { | ||
private static final Logger logger = LogManager.getLogger(DropIngestionErrorStrategy.class); | ||
private final String ingestionSource; | ||
|
||
public DropIngestionErrorStrategy(String ingestionSource) { | ||
this.ingestionSource = ingestionSource; | ||
} | ||
|
||
@Override | ||
public void handleError(Throwable e, ErrorStage stage) { | ||
logger.error("Error processing update from {}: {}", ingestionSource, e); | ||
|
||
// todo: record failed update stats and emit metrics | ||
} | ||
|
||
@Override | ||
public boolean shouldPauseIngestion(Throwable e, ErrorStage stage) { | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.