Skip to content

Commit

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



* bug fixes from prev pr



---------


(cherry picked from commit 77fc8b6)

Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 274b125 commit 5d4750e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,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 5d4750e

Please sign in to comment.