@@ -149,7 +149,7 @@ private void prepareProfile(
149
149
ActionListener <DetectorProfile > listener ,
150
150
Set <DetectorProfileName > profilesToCollect
151
151
) {
152
- String detectorId = detector .getDetectorId ();
152
+ String detectorId = detector .getId ();
153
153
GetRequest getRequest = new GetRequest (CommonName .JOB_INDEX , detectorId );
154
154
client .get (getRequest , ActionListener .wrap (getResponse -> {
155
155
if (getResponse != null && getResponse .isExists ()) {
@@ -162,7 +162,7 @@ private void prepareProfile(
162
162
AnomalyDetectorJob job = AnomalyDetectorJob .parse (parser );
163
163
long enabledTimeMs = job .getEnabledTime ().toEpochMilli ();
164
164
165
- boolean isMultiEntityDetector = detector .isMultientityDetector ();
165
+ boolean isMultiEntityDetector = detector .isHighCardinality ();
166
166
167
167
int totalResponsesToWait = 0 ;
168
168
if (profilesToCollect .contains (DetectorProfileName .ERROR )) {
@@ -284,8 +284,8 @@ private void prepareProfile(
284
284
}
285
285
286
286
private void profileEntityStats (MultiResponsesDelegateActionListener <DetectorProfile > listener , AnomalyDetector detector ) {
287
- List <String > categoryField = detector .getCategoryField ();
288
- if (!detector .isMultientityDetector () || categoryField .size () > ADNumericSetting .maxCategoricalFields ()) {
287
+ List <String > categoryField = detector .getCategoryFields ();
288
+ if (!detector .isHighCardinality () || categoryField .size () > ADNumericSetting .maxCategoricalFields ()) {
289
289
listener .onResponse (new DetectorProfile .Builder ().build ());
290
290
} else {
291
291
if (categoryField .size () == 1 ) {
@@ -304,7 +304,7 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
304
304
DetectorProfile profile = profileBuilder .totalEntities (value ).build ();
305
305
listener .onResponse (profile );
306
306
}, searchException -> {
307
- logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
307
+ logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getId ());
308
308
listener .onFailure (searchException );
309
309
});
310
310
// using the original context in listener as user roles have no permissions for internal operations like fetching a
@@ -313,7 +313,7 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
313
313
.<SearchRequest , SearchResponse >asyncRequestWithInjectedSecurity (
314
314
request ,
315
315
client ::search ,
316
- detector .getDetectorId (),
316
+ detector .getId (),
317
317
client ,
318
318
searchResponseListener
319
319
);
@@ -322,7 +322,11 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
322
322
AggregationBuilder bucketAggs = AggregationBuilders
323
323
.composite (
324
324
ADCommonName .TOTAL_ENTITIES ,
325
- detector .getCategoryField ().stream ().map (f -> new TermsValuesSourceBuilder (f ).field (f )).collect (Collectors .toList ())
325
+ detector
326
+ .getCategoryFields ()
327
+ .stream ()
328
+ .map (f -> new TermsValuesSourceBuilder (f ).field (f ))
329
+ .collect (Collectors .toList ())
326
330
)
327
331
.size (maxTotalEntitiesToTrack );
328
332
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder ().aggregation (bucketAggs ).trackTotalHits (false ).size (0 );
@@ -353,7 +357,7 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
353
357
DetectorProfile profile = profileBuilder .totalEntities (Long .valueOf (compositeAgg .getBuckets ().size ())).build ();
354
358
listener .onResponse (profile );
355
359
}, searchException -> {
356
- logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
360
+ logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getId ());
357
361
listener .onFailure (searchException );
358
362
});
359
363
// using the original context in listener as user roles have no permissions for internal operations like fetching a
@@ -362,7 +366,7 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
362
366
.<SearchRequest , SearchResponse >asyncRequestWithInjectedSecurity (
363
367
searchRequest ,
364
368
client ::search ,
365
- detector .getDetectorId (),
369
+ detector .getId (),
366
370
client ,
367
371
searchResponseListener
368
372
);
@@ -400,7 +404,7 @@ private void profileStateRelated(
400
404
Set <DetectorProfileName > profilesToCollect
401
405
) {
402
406
if (enabled ) {
403
- RCFPollingRequest request = new RCFPollingRequest (detector .getDetectorId ());
407
+ RCFPollingRequest request = new RCFPollingRequest (detector .getId ());
404
408
client .execute (RCFPollingAction .INSTANCE , request , onPollRCFUpdates (detector , profilesToCollect , listener ));
405
409
} else {
406
410
DetectorProfile .Builder builder = new DetectorProfile .Builder ();
@@ -419,7 +423,7 @@ private void profileModels(
419
423
MultiResponsesDelegateActionListener <DetectorProfile > listener
420
424
) {
421
425
DiscoveryNode [] dataNodes = nodeFilter .getEligibleDataNodes ();
422
- ProfileRequest profileRequest = new ProfileRequest (detector .getDetectorId (), profiles , forMultiEntityDetector , dataNodes );
426
+ ProfileRequest profileRequest = new ProfileRequest (detector .getId (), profiles , forMultiEntityDetector , dataNodes );
423
427
client .execute (ProfileAction .INSTANCE , profileRequest , onModelResponse (detector , profiles , job , listener ));// get init progress
424
428
}
425
429
@@ -429,7 +433,7 @@ private ActionListener<ProfileResponse> onModelResponse(
429
433
AnomalyDetectorJob job ,
430
434
MultiResponsesDelegateActionListener <DetectorProfile > listener
431
435
) {
432
- boolean isMultientityDetector = detector .isMultientityDetector ();
436
+ boolean isMultientityDetector = detector .isHighCardinality ();
433
437
return ActionListener .wrap (profileResponse -> {
434
438
DetectorProfile .Builder profile = new DetectorProfile .Builder ();
435
439
if (profilesToCollect .contains (DetectorProfileName .COORDINATING_NODE )) {
@@ -516,7 +520,7 @@ private ActionListener<SearchResponse> onInittedEver(
516
520
logger
517
521
.error (
518
522
"Fail to find any anomaly result with anomaly score larger than 0 after AD job enabled time for detector {}" ,
519
- detector .getDetectorId ()
523
+ detector .getId ()
520
524
);
521
525
listener .onFailure (exception );
522
526
}
@@ -565,11 +569,7 @@ private ActionListener<RCFPollingResponse> onPollRCFUpdates(
565
569
// data exists.
566
570
processInitResponse (detector , profilesToCollect , 0L , true , new DetectorProfile .Builder (), listener );
567
571
} else {
568
- logger
569
- .error (
570
- new ParameterizedMessage ("Fail to get init progress through messaging for {}" , detector .getDetectorId ()),
571
- exception
572
- );
572
+ logger .error (new ParameterizedMessage ("Fail to get init progress through messaging for {}" , detector .getId ()), exception );
573
573
listener .onFailure (exception );
574
574
}
575
575
});
@@ -603,7 +603,7 @@ private void processInitResponse(
603
603
InitProgressProfile initProgress = computeInitProgressProfile (totalUpdates , 0 );
604
604
builder .initProgress (initProgress );
605
605
} else {
606
- long intervalMins = ((IntervalTimeConfiguration ) detector .getDetectionInterval ()).toDuration ().toMinutes ();
606
+ long intervalMins = ((IntervalTimeConfiguration ) detector .getInterval ()).toDuration ().toMinutes ();
607
607
InitProgressProfile initProgress = computeInitProgressProfile (totalUpdates , intervalMins );
608
608
builder .initProgress (initProgress );
609
609
}
0 commit comments