increase watcher logging when delegating to trigger service
Original commit: elastic/x-pack-elasticsearch@448ee71f37
This commit is contained in:
parent
5d1a5f27b2
commit
fde2adb1b3
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.watcher;
|
package org.elasticsearch.xpack.watcher;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.cluster.ClusterChangedEvent;
|
import org.elasticsearch.cluster.ClusterChangedEvent;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
|
@ -115,16 +116,21 @@ final class WatcherIndexingListener extends AbstractComponent implements Indexin
|
||||||
// part of an execution, so we can exit early
|
// part of an execution, so we can exit early
|
||||||
boolean isWatchExecutionOperation = watch.status().version() != -1;
|
boolean isWatchExecutionOperation = watch.status().version() != -1;
|
||||||
if (isWatchExecutionOperation) {
|
if (isWatchExecutionOperation) {
|
||||||
|
logger.debug("not updating trigger for watch [{}], watch has been updated as part of an execution", watch.id());
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean shouldBeTriggered = shardAllocationConfiguration.shouldBeTriggered(watch.id());
|
boolean shouldBeTriggered = shardAllocationConfiguration.shouldBeTriggered(watch.id());
|
||||||
if (shouldBeTriggered) {
|
if (shouldBeTriggered) {
|
||||||
if (watch.status().state().isActive()) {
|
if (watch.status().state().isActive()) {
|
||||||
|
logger.debug("adding watch [{}] to trigger", watch.id());
|
||||||
triggerService.add(watch);
|
triggerService.add(watch);
|
||||||
} else {
|
} else {
|
||||||
|
logger.debug("removing watch [{}] to trigger", watch.id());
|
||||||
triggerService.remove(watch.id());
|
triggerService.remove(watch.id());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("watch [{}] should not be triggered", watch.id());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("Could not parse watch with id [{}]", e, operation.id());
|
throw new ElasticsearchParseException("Could not parse watch with id [{}]", e, operation.id());
|
||||||
|
@ -152,6 +158,7 @@ final class WatcherIndexingListener extends AbstractComponent implements Indexin
|
||||||
@Override
|
@Override
|
||||||
public void postIndex(ShardId shardId, Engine.Index index, Exception ex) {
|
public void postIndex(ShardId shardId, Engine.Index index, Exception ex) {
|
||||||
if (isWatchDocument(shardId.getIndexName(), index.type())) {
|
if (isWatchDocument(shardId.getIndexName(), index.type())) {
|
||||||
|
logger.debug(() -> new ParameterizedMessage("removing watch [{}] from trigger", index.id()), ex);
|
||||||
triggerService.remove(index.id());
|
triggerService.remove(index.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ integTestCluster {
|
||||||
setting 'xpack.security.enabled', 'false'
|
setting 'xpack.security.enabled', 'false'
|
||||||
setting 'xpack.monitoring.enabled', 'false'
|
setting 'xpack.monitoring.enabled', 'false'
|
||||||
setting 'xpack.ml.enabled', 'false'
|
setting 'xpack.ml.enabled', 'false'
|
||||||
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
||||||
|
|
||||||
//
|
//
|
||||||
// JIRA integration test settings
|
// JIRA integration test settings
|
||||||
|
|
Loading…
Reference in New Issue