Skip to content

Commit

Permalink
add logging for remote monitor execution flows (opensearch-project#1663)
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep authored Oct 2, 2024
1 parent d8f47a0 commit ba3e715
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ object MonitorRunnerService : JobRunner, CoroutineScope, AbstractLifecycleCompon
} else {
if (monitorCtx.remoteMonitors.containsKey(monitor.monitorType)) {
if (monitor.monitorType.endsWith(Monitor.MonitorType.DOC_LEVEL_MONITOR.value)) {
logger.info("Executing remote document monitor of type ${monitor.monitorType} id ${monitor.id}")
return RemoteDocumentLevelMonitorRunner().runMonitor(
monitor,
monitorCtx,
Expand All @@ -490,6 +491,7 @@ object MonitorRunnerService : JobRunner, CoroutineScope, AbstractLifecycleCompon
transportService = transportService
)
} else {
logger.info("Executing remote monitor of type ${monitor.monitorType} id ${monitor.id}")
return monitorCtx.remoteMonitors[monitor.monitorType]!!.monitorRunner.runMonitor(
monitor,
periodStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,11 @@ class TransportDocLevelMonitorFanOutAction
)
)
} catch (e: Exception) {
log.error("${request.monitor.id} Failed to run fan_out on node ${clusterService.localNode().id} due to error $e")
log.error(
"${request.monitor.id} Failed to run fan_out on node ${clusterService.localNode().id}." +
" for Monitor Type ${request.monitor.monitorType} ExecutionId ${request.executionId}",
e
)
listener.onFailure(AlertingException.wrap(e))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class RemoteMonitorRunner {
}

open fun getFanOutAction(): String {
return DocLevelMonitorFanOutAction.NAME
throw UnsupportedOperationException("Fan out action needs to be implemented by remote monitor.");
}

open suspend fun doFanOut(
Expand Down Expand Up @@ -185,4 +185,4 @@ open class RemoteMonitorRunner {
}
}
}
}
}

0 comments on commit ba3e715

Please sign in to comment.