Search in sources :

Example 1 with AnomalyDetectionException

use of org.opensearch.ad.common.exception.AnomalyDetectionException in project anomaly-detection by opensearch-project.

the class EntityColdStarter method coldStart.

/**
 * Training model for an entity
 * @param modelId model Id corresponding to the entity
 * @param entity the entity's information
 * @param detectorId the detector Id corresponding to the entity
 * @param modelState model state associated with the entity
 * @param listener call back to call after cold start
 */
private void coldStart(String modelId, Entity entity, String detectorId, ModelState<EntityModel> modelState, AnomalyDetector detector, ActionListener<Void> listener) {
    logger.debug("Trigger cold start for {}", modelId);
    if (lastThrottledColdStartTime.plus(Duration.ofMinutes(coolDownMinutes)).isAfter(clock.instant())) {
        listener.onResponse(null);
        return;
    }
    boolean earlyExit = true;
    try {
        DoorKeeper doorKeeper = doorKeepers.computeIfAbsent(detectorId, id -> {
            // reset every 60 intervals
            return new DoorKeeper(AnomalyDetectorSettings.DOOR_KEEPER_FOR_COLD_STARTER_MAX_INSERTION, AnomalyDetectorSettings.DOOR_KEEPER_FAULSE_POSITIVE_RATE, detector.getDetectionIntervalDuration().multipliedBy(AnomalyDetectorSettings.DOOR_KEEPER_MAINTENANCE_FREQ), clock);
        });
        // Won't retry cold start within 60 intervals for an entity
        if (doorKeeper.mightContain(modelId)) {
            return;
        }
        doorKeeper.put(modelId);
        ActionListener<Optional<List<double[][]>>> coldStartCallBack = ActionListener.wrap(trainingData -> {
            try {
                if (trainingData.isPresent()) {
                    List<double[][]> dataPoints = trainingData.get();
                    combineTrainSamples(dataPoints, modelId, modelState);
                    Queue<double[]> samples = modelState.getModel().getSamples();
                    // only train models if we have enough samples
                    if (samples.size() >= numMinSamples) {
                        // The function trainModelFromDataSegments will save a trained a model. trainModelFromDataSegments is called by
                        // multiple places so I want to make the saving model implicit just in case I forgot.
                        trainModelFromDataSegments(samples, entity, modelState, detector.getShingleSize());
                        logger.info("Succeeded in training entity: {}", modelId);
                    } else {
                        // save to checkpoint
                        checkpointWriteQueue.write(modelState, true, RequestPriority.MEDIUM);
                        logger.info("Not enough data to train entity: {}, currently we have {}", modelId, samples.size());
                    }
                } else {
                    logger.info("Cannot get training data for {}", modelId);
                }
                listener.onResponse(null);
            } catch (Exception e) {
                listener.onFailure(e);
            }
        }, exception -> {
            try {
                logger.error(new ParameterizedMessage("Error while cold start {}", modelId), exception);
                Throwable cause = Throwables.getRootCause(exception);
                if (ExceptionUtil.isOverloaded(cause)) {
                    logger.error("too many requests");
                    lastThrottledColdStartTime = Instant.now();
                } else if (cause instanceof AnomalyDetectionException || exception instanceof AnomalyDetectionException) {
                    // e.g., cannot find anomaly detector
                    nodeStateManager.setException(detectorId, exception);
                } else {
                    nodeStateManager.setException(detectorId, new AnomalyDetectionException(detectorId, cause));
                }
                listener.onFailure(exception);
            } catch (Exception e) {
                listener.onFailure(e);
            }
        });
        threadPool.executor(AnomalyDetectorPlugin.AD_THREAD_POOL_NAME).execute(() -> getEntityColdStartData(detectorId, entity, new ThreadedActionListener<>(logger, threadPool, AnomalyDetectorPlugin.AD_THREAD_POOL_NAME, coldStartCallBack, false)));
        earlyExit = false;
    } finally {
        if (earlyExit) {
            listener.onResponse(null);
        }
    }
}
Also used : AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) DoorKeeper(org.opensearch.ad.caching.DoorKeeper) ThreadedActionListener(org.opensearch.action.support.ThreadedActionListener) Optional(java.util.Optional) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) EndRunException(org.opensearch.ad.common.exception.EndRunException)

Example 2 with AnomalyDetectionException

use of org.opensearch.ad.common.exception.AnomalyDetectionException in project anomaly-detection by opensearch-project.

the class PriorityCache method maintenance.

/**
 * Maintain active entity's cache and door keepers.
 *
 * inActiveEntities is a Guava's LRU cache. The data structure itself is
 * gonna evict items if they are inactive for 3 days or its maximum size
 * reached (1 million entries)
 */
@Override
public void maintenance() {
    try {
        // clean up memory if we allocate more memory than we should
        tryClearUpMemory();
        activeEnities.entrySet().stream().forEach(cacheBufferEntry -> {
            String detectorId = cacheBufferEntry.getKey();
            CacheBuffer cacheBuffer = cacheBufferEntry.getValue();
            // remove expired cache buffer
            if (cacheBuffer.expired(modelTtl)) {
                activeEnities.remove(detectorId);
                cacheBuffer.clear();
            } else {
                List<ModelState<EntityModel>> removedStates = cacheBuffer.maintenance();
                for (ModelState<EntityModel> state : removedStates) {
                    addIntoInactiveCache(state);
                }
            }
        });
        maintainInactiveCache();
        doorKeepers.entrySet().stream().forEach(doorKeeperEntry -> {
            String detectorId = doorKeeperEntry.getKey();
            DoorKeeper doorKeeper = doorKeeperEntry.getValue();
            // doorKeeper has its own state ttl
            if (doorKeeper.expired(null)) {
                doorKeepers.remove(detectorId);
            } else {
                doorKeeper.maintenance();
            }
        });
    } catch (Exception e) {
        // will be thrown to ES's transport broadcast handler
        throw new AnomalyDetectionException("Fail to maintain cache", e);
    }
}
Also used : AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) EntityModel(org.opensearch.ad.ml.EntityModel) ModelState(org.opensearch.ad.ml.ModelState) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException)

Example 3 with AnomalyDetectionException

use of org.opensearch.ad.common.exception.AnomalyDetectionException in project anomaly-detection by opensearch-project.

the class MultiEntityResultHandlerTests method testIndexWriteBlock.

@Test
public void testIndexWriteBlock() throws InterruptedException {
    setWriteBlockAdResultIndex(true);
    CountDownLatch verified = new CountDownLatch(1);
    handler.flush(request, ActionListener.wrap(response -> {
        assertTrue("Should not reach here ", false);
        verified.countDown();
    }, exception -> {
        assertTrue(exception instanceof AnomalyDetectionException);
        assertTrue("actual: " + exception.getMessage(), exception.getMessage().contains(MultiEntityResultHandler.CANNOT_SAVE_RESULT_ERR_MSG));
        verified.countDown();
    }));
    assertTrue(verified.await(100, TimeUnit.SECONDS));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ADResultBulkRequest(org.opensearch.ad.transport.ADResultBulkRequest) ArgumentMatchers(org.mockito.ArgumentMatchers) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) RequestPriority(org.opensearch.ad.ratelimit.RequestPriority) IOException(java.io.IOException) Test(org.junit.Test) ADResultBulkAction(org.opensearch.ad.transport.ADResultBulkAction) Instant(java.time.Instant) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) TimeUnit(java.util.concurrent.TimeUnit) CountDownLatch(java.util.concurrent.CountDownLatch) ChronoUnit(java.time.temporal.ChronoUnit) ADResultBulkResponse(org.opensearch.ad.transport.ADResultBulkResponse) TestHelpers(org.opensearch.ad.TestHelpers) ResultWriteRequest(org.opensearch.ad.ratelimit.ResultWriteRequest) Mockito.doAnswer(org.mockito.Mockito.doAnswer) ActionListener(org.opensearch.action.ActionListener) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Example 4 with AnomalyDetectionException

use of org.opensearch.ad.common.exception.AnomalyDetectionException in project anomaly-detection by opensearch-project.

the class AnomalyResultTransportAction method doExecute.

/**
 * All the exceptions thrown by AD is a subclass of AnomalyDetectionException.
 *  ClientException is a subclass of AnomalyDetectionException. All exception visible to
 *   Client is under ClientVisible. Two classes directly extends ClientException:
 *   - InternalFailure for "root cause unknown failure. Maybe transient." We can continue the
 *    detector running.
 *   - EndRunException for "failures that might impact the customer." The method endNow() is
 *    added to indicate whether the client should immediately terminate running a detector.
 *      + endNow() returns true for "unrecoverable issue". We want to terminate the detector run
 *       immediately.
 *      + endNow() returns false for "maybe unrecoverable issue but worth retrying a few more
 *       times." We want to wait for a few more times on different requests before terminating
 *        the detector run.
 *
 *  AD may not be able to get an anomaly grade but can find a feature vector.  Consider the
 *   case when the shingle is not ready.  In that case, AD just put NaN as anomaly grade and
 *    return the feature vector. If AD cannot even find a feature vector, AD throws
 *     EndRunException if there is an issue or returns empty response (all the numeric fields
 *      are Double.NaN and feature array is empty.  Do so so that customer can write painless
 *       script.) otherwise.
 *
 *  Known causes of EndRunException with endNow returning false:
 *   + training data for cold start not available
 *   + cold start cannot succeed
 *   + unknown prediction error
 *   + memory circuit breaker tripped
 *   + invalid search query
 *
 *  Known causes of EndRunException with endNow returning true:
 *   + a model partition's memory size reached limit
 *   + models' total memory size reached limit
 *   + Having trouble querying feature data due to
 *    * index does not exist
 *    * all features have been disabled
 *
 *   + anomaly detector is not available
 *   + AD plugin is disabled
 *   + training data is invalid due to serious internal bug(s)
 *
 *  Known causes of InternalFailure:
 *   + threshold model node is not available
 *   + cluster read/write is blocked
 *   + cold start hasn't been finished
 *   + fail to get all of rcf model nodes' responses
 *   + fail to get threshold model node's response
 *   + RCF/Threshold model node failing to get checkpoint to restore model before timeout
 *   + Detection is throttle because previous detection query is running
 */
@Override
protected void doExecute(Task task, ActionRequest actionRequest, ActionListener<AnomalyResultResponse> listener) {
    try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
        AnomalyResultRequest request = AnomalyResultRequest.fromActionRequest(actionRequest);
        String adID = request.getAdID();
        ActionListener<AnomalyResultResponse> original = listener;
        listener = ActionListener.wrap(r -> {
            hcDetectors.remove(adID);
            original.onResponse(r);
        }, e -> {
            // we will not count it in failure stats.
            if (!(e instanceof AnomalyDetectionException) || ((AnomalyDetectionException) e).isCountedInStats()) {
                adStats.getStat(StatNames.AD_EXECUTE_FAIL_COUNT.getName()).increment();
                if (hcDetectors.contains(adID)) {
                    adStats.getStat(StatNames.AD_HC_EXECUTE_FAIL_COUNT.getName()).increment();
                }
            }
            hcDetectors.remove(adID);
            original.onFailure(e);
        });
        if (!EnabledSetting.isADPluginEnabled()) {
            throw new EndRunException(adID, CommonErrorMessages.DISABLED_ERR_MSG, true).countedInStats(false);
        }
        adStats.getStat(StatNames.AD_EXECUTE_REQUEST_COUNT.getName()).increment();
        if (adCircuitBreakerService.isOpen()) {
            listener.onFailure(new LimitExceededException(adID, CommonErrorMessages.MEMORY_CIRCUIT_BROKEN_ERR_MSG, false));
            return;
        }
        try {
            stateManager.getAnomalyDetector(adID, onGetDetector(listener, adID, request));
        } catch (Exception ex) {
            handleExecuteException(ex, listener, adID);
        }
    } catch (Exception e) {
        LOG.error(e);
        listener.onFailure(e);
    }
}
Also used : ResourceNotFoundException(org.opensearch.ad.common.exception.ResourceNotFoundException) ModelManager(org.opensearch.ad.ml.ModelManager) HashRing(org.opensearch.ad.cluster.HashRing) ADStats(org.opensearch.ad.stats.ADStats) ActionRequest(org.opensearch.action.ActionRequest) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Locale(java.util.Locale) Map(java.util.Map) NodeClosedException(org.opensearch.node.NodeClosedException) Inject(org.opensearch.common.inject.Inject) ActionListener(org.opensearch.action.ActionListener) NodeNotConnectedException(org.opensearch.transport.NodeNotConnectedException) Client(org.opensearch.client.Client) ActionNotFoundTransportException(org.opensearch.transport.ActionNotFoundTransportException) TransportRequestOptions(org.opensearch.transport.TransportRequestOptions) Set(java.util.Set) ExceptionsHelper(org.opensearch.ExceptionsHelper) ADTaskManager(org.opensearch.ad.task.ADTaskManager) Settings(org.opensearch.common.settings.Settings) Task(org.opensearch.tasks.Task) RestStatus(org.opensearch.rest.RestStatus) Collectors(java.util.stream.Collectors) TransportService(org.opensearch.transport.TransportService) ActionFilters(org.opensearch.action.support.ActionFilters) List(java.util.List) Logger(org.apache.logging.log4j.Logger) ExceptionUtil(org.opensearch.ad.util.ExceptionUtil) NodeStateManager(org.opensearch.ad.NodeStateManager) Entry(java.util.Map.Entry) OpenSearchTimeoutException(org.opensearch.OpenSearchTimeoutException) ActionListenerResponseHandler(org.opensearch.action.ActionListenerResponseHandler) Optional(java.util.Optional) SingleStreamModelIdMapper(org.opensearch.ad.ml.SingleStreamModelIdMapper) ConnectTransportException(org.opensearch.transport.ConnectTransportException) ReceiveTimeoutTransportException(org.opensearch.transport.ReceiveTimeoutTransportException) IndexNameExpressionResolver(org.opensearch.cluster.metadata.IndexNameExpressionResolver) ADCircuitBreakerService(org.opensearch.ad.breaker.ADCircuitBreakerService) MAX_ENTITIES_PER_QUERY(org.opensearch.ad.settings.AnomalyDetectorSettings.MAX_ENTITIES_PER_QUERY) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) HandledTransportAction(org.opensearch.action.support.HandledTransportAction) NotSerializableExceptionWrapper(org.opensearch.common.io.stream.NotSerializableExceptionWrapper) ThreadPool(org.opensearch.threadpool.ThreadPool) FeatureData(org.opensearch.ad.model.FeatureData) EnabledSetting(org.opensearch.ad.settings.EnabledSetting) Releasable(org.opensearch.common.lease.Releasable) IndicesOptions(org.opensearch.action.support.IndicesOptions) ThreadedActionListener(org.opensearch.action.support.ThreadedActionListener) AtomicReference(java.util.concurrent.atomic.AtomicReference) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) AnomalyDetectorSettings(org.opensearch.ad.settings.AnomalyDetectorSettings) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) PAGE_SIZE(org.opensearch.ad.settings.AnomalyDetectorSettings.PAGE_SIZE) ClientException(org.opensearch.ad.common.exception.ClientException) AnomalyDetector(org.opensearch.ad.model.AnomalyDetector) ConnectException(java.net.ConnectException) EndRunException(org.opensearch.ad.common.exception.EndRunException) SinglePointFeatures(org.opensearch.ad.feature.SinglePointFeatures) InternalFailure(org.opensearch.ad.common.exception.InternalFailure) CommonName(org.opensearch.ad.constant.CommonName) Iterator(java.util.Iterator) FeatureManager(org.opensearch.ad.feature.FeatureManager) ClusterBlockLevel(org.opensearch.cluster.block.ClusterBlockLevel) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) NotSerializedADExceptionName(org.opensearch.ad.common.exception.NotSerializedADExceptionName) INVALID_SEARCH_QUERY_MSG(org.opensearch.ad.constant.CommonErrorMessages.INVALID_SEARCH_QUERY_MSG) CompositeRetriever(org.opensearch.ad.feature.CompositeRetriever) PageIterator(org.opensearch.ad.feature.CompositeRetriever.PageIterator) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) CommonErrorMessages(org.opensearch.ad.constant.CommonErrorMessages) Entity(org.opensearch.ad.model.Entity) ShardSearchFailure(org.opensearch.action.search.ShardSearchFailure) NamedXContentRegistry(org.opensearch.common.xcontent.NamedXContentRegistry) ClusterService(org.opensearch.cluster.service.ClusterService) AnomalyDetectorPlugin(org.opensearch.ad.AnomalyDetectorPlugin) SearchPhaseExecutionException(org.opensearch.action.search.SearchPhaseExecutionException) IntervalTimeConfiguration(org.opensearch.ad.model.IntervalTimeConfiguration) StatNames(org.opensearch.ad.stats.StatNames) LogManager(org.apache.logging.log4j.LogManager) NetworkExceptionHelper(org.opensearch.common.transport.NetworkExceptionHelper) ParseUtils(org.opensearch.ad.util.ParseUtils) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) EndRunException(org.opensearch.ad.common.exception.EndRunException) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) ResourceNotFoundException(org.opensearch.ad.common.exception.ResourceNotFoundException) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) NodeClosedException(org.opensearch.node.NodeClosedException) NodeNotConnectedException(org.opensearch.transport.NodeNotConnectedException) ActionNotFoundTransportException(org.opensearch.transport.ActionNotFoundTransportException) OpenSearchTimeoutException(org.opensearch.OpenSearchTimeoutException) ConnectTransportException(org.opensearch.transport.ConnectTransportException) ReceiveTimeoutTransportException(org.opensearch.transport.ReceiveTimeoutTransportException) ClientException(org.opensearch.ad.common.exception.ClientException) ConnectException(java.net.ConnectException) EndRunException(org.opensearch.ad.common.exception.EndRunException) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) SearchPhaseExecutionException(org.opensearch.action.search.SearchPhaseExecutionException)

Example 5 with AnomalyDetectionException

use of org.opensearch.ad.common.exception.AnomalyDetectionException in project anomaly-detection by opensearch-project.

the class AnomalyResultTransportAction method coldStartIfNoCheckPoint.

/**
 * Check if checkpoint for an detector exists or not.  If not and previous
 *  run is not EndRunException whose endNow is true, trigger cold start.
 * @param detector detector object
 * @return previous cold start exception
 */
private Optional<Exception> coldStartIfNoCheckPoint(AnomalyDetector detector) {
    String detectorId = detector.getDetectorId();
    Optional<Exception> previousException = stateManager.fetchExceptionAndClear(detectorId);
    if (previousException.isPresent()) {
        Exception exception = previousException.get();
        LOG.error(new ParameterizedMessage("Previous exception of {}:", detectorId), exception);
        if (exception instanceof EndRunException && ((EndRunException) exception).isEndNow()) {
            return previousException;
        }
    }
    stateManager.getDetectorCheckpoint(detectorId, ActionListener.wrap(checkpointExists -> {
        if (!checkpointExists) {
            LOG.info("Trigger cold start for {}", detectorId);
            coldStart(detector);
        }
    }, exception -> {
        Throwable cause = ExceptionsHelper.unwrapCause(exception);
        if (cause instanceof IndexNotFoundException) {
            LOG.info("Trigger cold start for {}", detectorId);
            coldStart(detector);
        } else {
            String errorMsg = String.format(Locale.ROOT, "Fail to get checkpoint state for %s", detectorId);
            LOG.error(errorMsg, exception);
            stateManager.setException(detectorId, new AnomalyDetectionException(errorMsg, exception));
        }
    }));
    return previousException;
}
Also used : ResourceNotFoundException(org.opensearch.ad.common.exception.ResourceNotFoundException) ModelManager(org.opensearch.ad.ml.ModelManager) HashRing(org.opensearch.ad.cluster.HashRing) ADStats(org.opensearch.ad.stats.ADStats) ActionRequest(org.opensearch.action.ActionRequest) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Locale(java.util.Locale) Map(java.util.Map) NodeClosedException(org.opensearch.node.NodeClosedException) Inject(org.opensearch.common.inject.Inject) ActionListener(org.opensearch.action.ActionListener) NodeNotConnectedException(org.opensearch.transport.NodeNotConnectedException) Client(org.opensearch.client.Client) ActionNotFoundTransportException(org.opensearch.transport.ActionNotFoundTransportException) TransportRequestOptions(org.opensearch.transport.TransportRequestOptions) Set(java.util.Set) ExceptionsHelper(org.opensearch.ExceptionsHelper) ADTaskManager(org.opensearch.ad.task.ADTaskManager) Settings(org.opensearch.common.settings.Settings) Task(org.opensearch.tasks.Task) RestStatus(org.opensearch.rest.RestStatus) Collectors(java.util.stream.Collectors) TransportService(org.opensearch.transport.TransportService) ActionFilters(org.opensearch.action.support.ActionFilters) List(java.util.List) Logger(org.apache.logging.log4j.Logger) ExceptionUtil(org.opensearch.ad.util.ExceptionUtil) NodeStateManager(org.opensearch.ad.NodeStateManager) Entry(java.util.Map.Entry) OpenSearchTimeoutException(org.opensearch.OpenSearchTimeoutException) ActionListenerResponseHandler(org.opensearch.action.ActionListenerResponseHandler) Optional(java.util.Optional) SingleStreamModelIdMapper(org.opensearch.ad.ml.SingleStreamModelIdMapper) ConnectTransportException(org.opensearch.transport.ConnectTransportException) ReceiveTimeoutTransportException(org.opensearch.transport.ReceiveTimeoutTransportException) IndexNameExpressionResolver(org.opensearch.cluster.metadata.IndexNameExpressionResolver) ADCircuitBreakerService(org.opensearch.ad.breaker.ADCircuitBreakerService) MAX_ENTITIES_PER_QUERY(org.opensearch.ad.settings.AnomalyDetectorSettings.MAX_ENTITIES_PER_QUERY) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) HandledTransportAction(org.opensearch.action.support.HandledTransportAction) NotSerializableExceptionWrapper(org.opensearch.common.io.stream.NotSerializableExceptionWrapper) ThreadPool(org.opensearch.threadpool.ThreadPool) FeatureData(org.opensearch.ad.model.FeatureData) EnabledSetting(org.opensearch.ad.settings.EnabledSetting) Releasable(org.opensearch.common.lease.Releasable) IndicesOptions(org.opensearch.action.support.IndicesOptions) ThreadedActionListener(org.opensearch.action.support.ThreadedActionListener) AtomicReference(java.util.concurrent.atomic.AtomicReference) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) AnomalyDetectorSettings(org.opensearch.ad.settings.AnomalyDetectorSettings) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) PAGE_SIZE(org.opensearch.ad.settings.AnomalyDetectorSettings.PAGE_SIZE) ClientException(org.opensearch.ad.common.exception.ClientException) AnomalyDetector(org.opensearch.ad.model.AnomalyDetector) ConnectException(java.net.ConnectException) EndRunException(org.opensearch.ad.common.exception.EndRunException) SinglePointFeatures(org.opensearch.ad.feature.SinglePointFeatures) InternalFailure(org.opensearch.ad.common.exception.InternalFailure) CommonName(org.opensearch.ad.constant.CommonName) Iterator(java.util.Iterator) FeatureManager(org.opensearch.ad.feature.FeatureManager) ClusterBlockLevel(org.opensearch.cluster.block.ClusterBlockLevel) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) NotSerializedADExceptionName(org.opensearch.ad.common.exception.NotSerializedADExceptionName) INVALID_SEARCH_QUERY_MSG(org.opensearch.ad.constant.CommonErrorMessages.INVALID_SEARCH_QUERY_MSG) CompositeRetriever(org.opensearch.ad.feature.CompositeRetriever) PageIterator(org.opensearch.ad.feature.CompositeRetriever.PageIterator) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) CommonErrorMessages(org.opensearch.ad.constant.CommonErrorMessages) Entity(org.opensearch.ad.model.Entity) ShardSearchFailure(org.opensearch.action.search.ShardSearchFailure) NamedXContentRegistry(org.opensearch.common.xcontent.NamedXContentRegistry) ClusterService(org.opensearch.cluster.service.ClusterService) AnomalyDetectorPlugin(org.opensearch.ad.AnomalyDetectorPlugin) SearchPhaseExecutionException(org.opensearch.action.search.SearchPhaseExecutionException) IntervalTimeConfiguration(org.opensearch.ad.model.IntervalTimeConfiguration) StatNames(org.opensearch.ad.stats.StatNames) LogManager(org.apache.logging.log4j.LogManager) NetworkExceptionHelper(org.opensearch.common.transport.NetworkExceptionHelper) ParseUtils(org.opensearch.ad.util.ParseUtils) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) EndRunException(org.opensearch.ad.common.exception.EndRunException) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) ResourceNotFoundException(org.opensearch.ad.common.exception.ResourceNotFoundException) LimitExceededException(org.opensearch.ad.common.exception.LimitExceededException) AnomalyDetectionException(org.opensearch.ad.common.exception.AnomalyDetectionException) NodeClosedException(org.opensearch.node.NodeClosedException) NodeNotConnectedException(org.opensearch.transport.NodeNotConnectedException) ActionNotFoundTransportException(org.opensearch.transport.ActionNotFoundTransportException) OpenSearchTimeoutException(org.opensearch.OpenSearchTimeoutException) ConnectTransportException(org.opensearch.transport.ConnectTransportException) ReceiveTimeoutTransportException(org.opensearch.transport.ReceiveTimeoutTransportException) ClientException(org.opensearch.ad.common.exception.ClientException) ConnectException(java.net.ConnectException) EndRunException(org.opensearch.ad.common.exception.EndRunException) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) SearchPhaseExecutionException(org.opensearch.action.search.SearchPhaseExecutionException)

Aggregations

AnomalyDetectionException (org.opensearch.ad.common.exception.AnomalyDetectionException)28 ActionListener (org.opensearch.action.ActionListener)10 IOException (java.io.IOException)9 Optional (java.util.Optional)8 EndRunException (org.opensearch.ad.common.exception.EndRunException)7 AnomalyDetector (org.opensearch.ad.model.AnomalyDetector)7 LogManager (org.apache.logging.log4j.LogManager)6 Logger (org.apache.logging.log4j.Logger)6 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)6 ClusterService (org.opensearch.cluster.service.ClusterService)6 Settings (org.opensearch.common.settings.Settings)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 ModelManager (org.opensearch.ad.ml.ModelManager)5 Instant (java.time.Instant)4 Map (java.util.Map)4 ThreadedActionListener (org.opensearch.action.support.ThreadedActionListener)4 LimitExceededException (org.opensearch.ad.common.exception.LimitExceededException)4 ResourceNotFoundException (org.opensearch.ad.common.exception.ResourceNotFoundException)4 Entity (org.opensearch.ad.model.Entity)4