11
11
12
12
package org .opensearch .ad ;
13
13
14
- import static org .opensearch .ad .constant .CommonErrorMessages .FAIL_TO_FIND_DETECTOR_MSG ;
15
- import static org .opensearch .ad .constant .CommonErrorMessages .FAIL_TO_PARSE_DETECTOR_MSG ;
14
+ import static org .opensearch .ad .constant .ADCommonMessages .FAIL_TO_PARSE_DETECTOR_MSG ;
16
15
import static org .opensearch .common .xcontent .XContentParserUtils .ensureExpectedToken ;
17
16
import static org .opensearch .rest .RestStatus .BAD_REQUEST ;
18
17
import static org .opensearch .rest .RestStatus .INTERNAL_SERVER_ERROR ;
18
+ import static org .opensearch .timeseries .constant .CommonMessages .FAIL_TO_FIND_CONFIG_MSG ;
19
19
20
20
import java .util .List ;
21
21
import java .util .Map ;
33
33
import org .opensearch .action .search .SearchResponse ;
34
34
import org .opensearch .ad .common .exception .NotSerializedADExceptionName ;
35
35
import org .opensearch .ad .common .exception .ResourceNotFoundException ;
36
+ import org .opensearch .ad .constant .ADCommonMessages ;
36
37
import org .opensearch .ad .constant .ADCommonName ;
37
- import org .opensearch .ad .constant .CommonErrorMessages ;
38
38
import org .opensearch .ad .model .ADTaskType ;
39
39
import org .opensearch .ad .model .AnomalyDetector ;
40
40
import org .opensearch .ad .model .AnomalyDetectorJob ;
@@ -109,7 +109,7 @@ public AnomalyDetectorProfileRunner(
109
109
110
110
public void profile (String detectorId , ActionListener <DetectorProfile > listener , Set <DetectorProfileName > profilesToCollect ) {
111
111
if (profilesToCollect .isEmpty ()) {
112
- listener .onFailure (new IllegalArgumentException (CommonErrorMessages .EMPTY_PROFILES_COLLECT ));
112
+ listener .onFailure (new IllegalArgumentException (ADCommonMessages .EMPTY_PROFILES_COLLECT ));
113
113
return ;
114
114
}
115
115
calculateTotalResponsesToWait (detectorId , profilesToCollect , listener );
@@ -136,11 +136,11 @@ private void calculateTotalResponsesToWait(
136
136
listener .onFailure (new OpenSearchStatusException (FAIL_TO_PARSE_DETECTOR_MSG + detectorId , BAD_REQUEST ));
137
137
}
138
138
} else {
139
- listener .onFailure (new OpenSearchStatusException (FAIL_TO_FIND_DETECTOR_MSG + detectorId , BAD_REQUEST ));
139
+ listener .onFailure (new OpenSearchStatusException (FAIL_TO_FIND_CONFIG_MSG + detectorId , BAD_REQUEST ));
140
140
}
141
141
}, exception -> {
142
- logger .error (FAIL_TO_FIND_DETECTOR_MSG + detectorId , exception );
143
- listener .onFailure (new OpenSearchStatusException (FAIL_TO_FIND_DETECTOR_MSG + detectorId , INTERNAL_SERVER_ERROR ));
142
+ logger .error (FAIL_TO_FIND_CONFIG_MSG + detectorId , exception );
143
+ listener .onFailure (new OpenSearchStatusException (FAIL_TO_FIND_CONFIG_MSG + detectorId , INTERNAL_SERVER_ERROR ));
144
144
}));
145
145
}
146
146
@@ -207,7 +207,7 @@ private void prepareProfile(
207
207
new MultiResponsesDelegateActionListener <DetectorProfile >(
208
208
listener ,
209
209
totalResponsesToWait ,
210
- CommonErrorMessages .FAIL_FETCH_ERR_MSG + detectorId ,
210
+ ADCommonMessages .FAIL_FETCH_ERR_MSG + detectorId ,
211
211
false
212
212
);
213
213
if (profilesToCollect .contains (DetectorProfileName .ERROR )) {
@@ -266,7 +266,7 @@ private void prepareProfile(
266
266
}
267
267
268
268
} catch (Exception e ) {
269
- logger .error (CommonErrorMessages .FAIL_TO_GET_PROFILE_MSG , e );
269
+ logger .error (ADCommonMessages .FAIL_TO_GET_PROFILE_MSG , e );
270
270
listener .onFailure (e );
271
271
}
272
272
} else {
@@ -277,7 +277,7 @@ private void prepareProfile(
277
277
logger .info (exception .getMessage ());
278
278
onGetDetectorForPrepare (detectorId , listener , profilesToCollect );
279
279
} else {
280
- logger .error (CommonErrorMessages .FAIL_TO_GET_PROFILE_MSG + detectorId );
280
+ logger .error (ADCommonMessages .FAIL_TO_GET_PROFILE_MSG + detectorId );
281
281
listener .onFailure (exception );
282
282
}
283
283
}));
@@ -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 (CommonErrorMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
307
+ logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
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
@@ -353,7 +353,7 @@ private void profileEntityStats(MultiResponsesDelegateActionListener<DetectorPro
353
353
DetectorProfile profile = profileBuilder .totalEntities (Long .valueOf (compositeAgg .getBuckets ().size ())).build ();
354
354
listener .onResponse (profile );
355
355
}, searchException -> {
356
- logger .warn (CommonErrorMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
356
+ logger .warn (ADCommonMessages .FAIL_TO_GET_TOTAL_ENTITIES + detector .getDetectorId ());
357
357
listener .onFailure (searchException );
358
358
});
359
359
// using the original context in listener as user roles have no permissions for internal operations like fetching a
0 commit comments