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

Add messages, attributes, names required for multi-entity detectors #260

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 @@ -26,4 +26,7 @@ public class CommonErrorMessages {
public static final String MEMORY_CIRCUIT_BROKEN_ERR_MSG = "AD memory circuit is broken.";
public static final String DISABLED_ERR_MSG = "AD plugin is disabled. To enable update opendistro.anomaly_detection.enabled to true";
public static final String INVALID_SEARCH_QUERY_MSG = "Invalid search query.";
public static final String ALL_FEATURES_DISABLED_ERR_MSG =
"Having trouble querying data because all of your features have been disabled.";
public static final String INVALID_TIMESTAMP_ERR_MSG = "timestamp is invalid";
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public class CommonMessageAttributes {
public static final String CONFIDENCE_JSON_KEY = "confidence";
public static final String ANOMALY_GRADE_JSON_KEY = "anomalyGrade";
public static final String QUEUE_JSON_KEY = "queue";
public static final String START_JSON_KEY = "start";
public static final String END_JSON_KEY = "end";
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public class CommonName {
public static final String MODELS = "models";
public static final String INIT_PROGRESS = "init_progress";

public static final String TOTAL_ENTITIES = "total_entities";
public static final String ACTIVE_ENTITIES = "active_entities";

// Elastic mapping type
public static final String MAPPING_TYPE = "_doc";

Expand All @@ -68,4 +71,6 @@ public class CommonName {
public static final String KEYWORD_TYPE = "keyword";

public static final String IP_TYPE = "ip";

public static final String TOTAL_UPDATES = "total_updates";
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes;

public class AnomalyResultRequest extends ActionRequest implements ToXContentObject {
static final String INVALID_TIMESTAMP_ERR_MSG = "timestamp is invalid";
static final String START_JSON_KEY = "start";
static final String END_JSON_KEY = "end";

private String adID;
// time range start and end. Unit: epoch milliseconds
private long start;
Expand Down Expand Up @@ -87,7 +83,7 @@ public ActionRequestValidationException validate() {
}
if (start <= 0 || end <= 0 || start > end) {
validationException = addValidationError(
String.format(Locale.ROOT, "%s: start %d, end %d", INVALID_TIMESTAMP_ERR_MSG, start, end),
String.format(Locale.ROOT, "%s: start %d, end %d", CommonErrorMessages.INVALID_TIMESTAMP_ERR_MSG, start, end),
validationException
);
}
Expand All @@ -98,8 +94,8 @@ public ActionRequestValidationException validate() {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(CommonMessageAttributes.ID_JSON_KEY, adID);
builder.field(START_JSON_KEY, start);
builder.field(END_JSON_KEY, end);
builder.field(CommonMessageAttributes.START_JSON_KEY, start);
builder.field(CommonMessageAttributes.END_JSON_KEY, end);
builder.endObject();
return builder;
}
Expand Down