diff --git a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/MonitorRunner.kt b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/MonitorRunner.kt index bf9c7017..67c19dff 100644 --- a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/MonitorRunner.kt +++ b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/MonitorRunner.kt @@ -55,14 +55,13 @@ import com.amazon.opendistroforelasticsearch.alerting.settings.DestinationSettin import com.amazon.opendistroforelasticsearch.alerting.settings.DestinationSettings.Companion.loadDestinationSettings import com.amazon.opendistroforelasticsearch.alerting.util.IndexUtils import com.amazon.opendistroforelasticsearch.alerting.util.isAllowed -import org.apache.logging.log4j.LogManager import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext +import org.apache.logging.log4j.LogManager import org.elasticsearch.ExceptionsHelper import org.elasticsearch.action.DocWriteRequest import org.elasticsearch.action.bulk.BackoffPolicy @@ -224,7 +223,7 @@ class MonitorRunner( logger.error("Error loading alerts for monitor: $id", e) return monitorResult.copy(error = e) } - runBlocking(InjectorContextElement(monitor.id, settings, threadPool.threadContext, roles)) { + withContext(InjectorContextElement(monitor.id, settings, threadPool.threadContext, roles)) { monitorResult = monitorResult.copy(inputResults = collectInputResults(monitor, periodStart, periodEnd)) } val updatedAlerts = mutableListOf() diff --git a/core/build.gradle b/core/build.gradle index e6867baf..bea25432 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -25,12 +25,9 @@ dependencies { compile "com.cronutils:cron-utils:7.0.5" compile "org.elasticsearch.client:elasticsearch-rest-client:${es_version}" compile 'com.google.googlejavaformat:google-java-format:1.3' + compile "com.amazon.opendistroforelasticsearch:common-utils:${opendistroVersion}.0" testImplementation "org.elasticsearch.test:framework:${es_version}" testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}" testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${kotlin_version}" - - - //fixme: pick it from maven, pending on https://github.com/opendistro-for-elasticsearch/common-utils/pull/3 - compile files('libs/common-utils-1.10.1.0.jar') } diff --git a/core/libs/common-utils-1.10.1.0.jar b/core/libs/common-utils-1.10.1.0.jar deleted file mode 100644 index 5327060d..00000000 Binary files a/core/libs/common-utils-1.10.1.0.jar and /dev/null differ