[7.x][ML] Audit force stopping data frame analytics (#60973) (#61004)

Audits a message when a data frame analytics job is force stopped.

Backport of #60973
This commit is contained in:
Dimitris Athanasiou 2020-08-12 07:45:26 +03:00 committed by GitHub
parent c7b0290256
commit 2e18c0f2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -61,6 +61,7 @@ public final class Messages {
public static final String DATA_FRAME_ANALYTICS_AUDIT_UPDATED = "Updated analytics settings: {0}"; public static final String DATA_FRAME_ANALYTICS_AUDIT_UPDATED = "Updated analytics settings: {0}";
public static final String DATA_FRAME_ANALYTICS_AUDIT_STARTED = "Started analytics"; public static final String DATA_FRAME_ANALYTICS_AUDIT_STARTED = "Started analytics";
public static final String DATA_FRAME_ANALYTICS_AUDIT_STOPPED = "Stopped analytics"; public static final String DATA_FRAME_ANALYTICS_AUDIT_STOPPED = "Stopped analytics";
public static final String DATA_FRAME_ANALYTICS_AUDIT_FORCE_STOPPED = "Stopped analytics (forced)";
public static final String DATA_FRAME_ANALYTICS_AUDIT_DELETED = "Deleted analytics"; public static final String DATA_FRAME_ANALYTICS_AUDIT_DELETED = "Deleted analytics";
public static final String DATA_FRAME_ANALYTICS_AUDIT_UPDATED_STATE_WITH_REASON = public static final String DATA_FRAME_ANALYTICS_AUDIT_UPDATED_STATE_WITH_REASON =
"Updated analytics task state to [{0}] with reason [{1}]"; "Updated analytics task state to [{0}] with reason [{1}]";

View File

@ -217,6 +217,7 @@ public class TransportStopDataFrameAnalyticsAction
if (analyticsTask != null) { if (analyticsTask != null) {
persistentTasksService.sendRemoveRequest(analyticsTask.getId(), ActionListener.wrap( persistentTasksService.sendRemoveRequest(analyticsTask.getId(), ActionListener.wrap(
removedTask -> { removedTask -> {
auditor.info(analyticsId, Messages.DATA_FRAME_ANALYTICS_AUDIT_FORCE_STOPPED);
if (counter.incrementAndGet() == nonStoppedAnalytics.size()) { if (counter.incrementAndGet() == nonStoppedAnalytics.size()) {
sendResponseOrFailure(request.getId(), listener, failures); sendResponseOrFailure(request.getId(), listener, failures);
} }