Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add comments and remove debug messages #266

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

public class ADResultBulkTransportAction extends HandledTransportAction<ADResultBulkRequest, BulkResponse> {

private static final Logger LOG = LogManager.getLogger(ADResultBulkAction.class);
private static final Logger LOG = LogManager.getLogger(ADResultBulkTransportAction.class);
private IndexingPressure indexingPressure;
private final long primaryAndCoordinatingLimits;
private float softLimit;
Expand Down Expand Up @@ -79,7 +79,6 @@ protected void doExecute(Task task, ADResultBulkRequest request, ActionListener<
// Write all until index pressure (global indexing memory pressure) is less than 80% of 10% of heap. Otherwise, index
// all non-zero anomaly grade index requests and index zero anomaly grade index requests with probability (1 - index pressure).
long totalBytes = indexingPressure.getCurrentCombinedCoordinatingAndPrimaryBytes() + indexingPressure.getCurrentReplicaBytes();
LOG.info(primaryAndCoordinatingLimits + " " + totalBytes);
float indexingPressurePercent = (float) totalBytes / primaryAndCoordinatingLimits;

BulkRequest bulkRequest = new BulkRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;

public class IndexUtils {
/**
Expand All @@ -51,13 +52,14 @@ public class IndexUtils {
private final IndexNameExpressionResolver indexNameExpressionResolver;

/**
* Constructor
* Inject annotation required by Guice to instantiate EntityResultTransportAction (transitive dependency)
*
* @param client Client to make calls to ElasticSearch
* @param clientUtil AD Client utility
* @param clusterService ES ClusterService
* @param indexNameExpressionResolver index name resolver
*/
@Inject
public IndexUtils(
Client client,
ClientUtil clientUtil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.concurrent.ConcurrentHashMap;

import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.common.inject.Inject;

/**
* Utility functions for throttling query.
Expand All @@ -33,6 +34,12 @@ public class Throttler {
private final ConcurrentHashMap<String, Map.Entry<ActionRequest, Instant>> negativeCache;
private final Clock clock;

/**
* Inject annotation required by Guice to instantiate EntityResultTransportAction (transitive dependency)
* (EntityResultTransportAction &gt; ResultHandler &gt; ClientUtil &gt; Throttler)
* @param clock a UTC clock
*/
@Inject
public Throttler(Clock clock) {
this.negativeCache = new ConcurrentHashMap<>();
this.clock = clock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ public void setUp() throws Exception {

channel = mock(ActionListener.class);

// final RestRequest restRequest = createRestRequest(Method.POST);

// when(channel.request()).thenReturn(restRequest);
// when(channel.newErrorBuilder()).thenReturn(JsonXContent.contentBuilder());
// when(channel.detailedErrorsEnabled()).thenReturn(true);

anomalyDetectionIndices = mock(AnomalyDetectionIndices.class);
when(anomalyDetectionIndices.doesAnomalyDetectorIndexExist()).thenReturn(true);

Expand Down Expand Up @@ -199,7 +193,6 @@ public void testTwoCategoricalFields() throws IOException {
IllegalArgumentException.class,
() -> TestHelpers.randomAnomalyDetectorUsingCategoryFields(detectorId, Arrays.asList("a", "b"))
);
;
}

@SuppressWarnings("unchecked")
Expand Down