Skip to content

Commit

Permalink
fix fieldLimit exception in docLevelMonitor (#1368)
Browse files Browse the repository at this point in the history
* fix fieldLimit exception in  docLevelMonitor

Signed-off-by: Riya Saxena <[email protected]>

* bug fixes from prev pr

Signed-off-by: Riya Saxena <[email protected]>

---------

Signed-off-by: Riya Saxena <[email protected]>
(cherry picked from commit 77fc8b6)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Apr 9, 2024
1 parent fd8febb commit 904adc4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,16 @@ class DocumentLevelMonitorRunner : MonitorRunner() {
monitorCtx.alertIndices!!.createOrUpdateInitialFindingHistoryIndex(monitor.dataSources)
} catch (e: Exception) {
val id = if (monitor.id.trim().isEmpty()) "_na_" else monitor.id
logger.error("Error setting up alerts and findings indices for monitor: $id", e)
monitorResult = monitorResult.copy(error = AlertingException.wrap(e))
val unwrappedException = ExceptionsHelper.unwrapCause(e)
if (unwrappedException is IllegalArgumentException && unwrappedException.message?.contains("Limit of total fields") == true) {
val errorMessage =
"Monitor [$id] can't process index [$monitor.dataSources] due to field mapping limit"
logger.error("Exception: ${unwrappedException.message}")
monitorResult = monitorResult.copy(error = AlertingException(errorMessage, RestStatus.INTERNAL_SERVER_ERROR, e))
} else {
logger.error("Error setting up alerts and findings indices for monitor: $id", e)
monitorResult = monitorResult.copy(error = AlertingException.wrap(e))
}
}
try {
validate(monitor)
Expand Down

0 comments on commit 904adc4

Please sign in to comment.