forked from opensearch-project/alerting
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add monitor metadata and monitor objects to fan out request to avoid …
…disk seeks Signed-off-by: Surya Sashank Nistala <[email protected]>
- Loading branch information
Showing
2 changed files
with
64 additions
and
6 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
51 changes: 51 additions & 0 deletions
51
...src/main/kotlin/org/opensearch/alerting/transport/TransportDocLevelMonitorFanOutAction.kt
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,51 @@ | ||
package org.opensearch.alerting.transport | ||
|
||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import org.apache.logging.log4j.LogManager | ||
import org.opensearch.action.support.ActionFilters | ||
import org.opensearch.action.support.HandledTransportAction | ||
import org.opensearch.alerting.MonitorRunnerExecutionContext | ||
import org.opensearch.alerting.action.DocLevelMonitorFanOutRequest | ||
import org.opensearch.alerting.action.DocLevelMonitorFanOutResponse | ||
import org.opensearch.alerting.settings.AlertingSettings | ||
import org.opensearch.client.Client | ||
import org.opensearch.cluster.service.ClusterService | ||
import org.opensearch.common.inject.Inject | ||
import org.opensearch.common.settings.Settings | ||
import org.opensearch.commons.alerting.action.AlertingActions | ||
import org.opensearch.core.action.ActionListener | ||
import org.opensearch.core.xcontent.NamedXContentRegistry | ||
import org.opensearch.tasks.Task | ||
import org.opensearch.transport.TransportService | ||
|
||
private val log = LogManager.getLogger(TransportDocLevelMonitorFanOutAction::class.java) | ||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO) | ||
|
||
class TransportDocLevelMonitorFanOutAction @Inject constructor( | ||
transportService: TransportService, | ||
val client: Client, | ||
val actionFilters: ActionFilters, | ||
val clusterService: ClusterService, | ||
val settings: Settings, | ||
val xContentRegistry: NamedXContentRegistry, | ||
val monitorCtx: MonitorRunnerExecutionContext, | ||
|
||
) : HandledTransportAction<DocLevelMonitorFanOutRequest, DocLevelMonitorFanOutResponse>( | ||
AlertingActions.INDEX_MONITOR_ACTION_NAME, transportService, actionFilters, ::DocLevelMonitorFanOutRequest | ||
), | ||
SecureTransportAction { | ||
|
||
@Volatile | ||
override var filterByEnabled = AlertingSettings.FILTER_BY_BACKEND_ROLES.get(settings) | ||
override fun doExecute( | ||
task: Task, | ||
request: DocLevelMonitorFanOutRequest, | ||
listener: ActionListener<DocLevelMonitorFanOutResponse>, | ||
) { | ||
executeMonitor(request, monitorCtx) | ||
} | ||
|
||
private fun executeMonitor(request: DocLevelMonitorFanOutRequest, monitorCtx: MonitorRunnerExecutionContext) { | ||
} | ||
} |