Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use snapshot's latest result time rather than snapshot's creation time when creating an annotation #56093

Merged
merged 2 commits into from
May 4, 2020
Merged
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 @@ -89,6 +89,10 @@ private static ObjectParser<Builder, Void> createParser(boolean ignoreUnknownFie
*/
private final Version minVersion;

/**
* This is model snapshot's creation wall clock time.
* Use {@code latestResultTimeStamp} if you need model time instead.
*/
private final Date timestamp;
private final String description;
private final String snapshotId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ private Annotation createModelSnapshotAnnotation(ModelSnapshot modelSnapshot) {
Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_STORED, modelSnapshot.getSnapshotId()),
currentTime,
XPackUser.NAME,
modelSnapshot.getTimestamp(),
modelSnapshot.getTimestamp(),
modelSnapshot.getLatestResultTimeStamp(),
modelSnapshot.getLatestResultTimeStamp(),
jobId,
currentTime,
XPackUser.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ private static ModelSizeStats createModelSizeStats() {
private static ModelSnapshot createModelSnapshot() {
return new ModelSnapshot.Builder(JOB_ID)
.setSnapshotId(randomAlphaOfLength(12))
.setTimestamp(Date.from(Instant.ofEpochMilli(1000000000)))
.setLatestResultTimeStamp(Date.from(Instant.ofEpochMilli(1000_000_000)))
.setTimestamp(Date.from(Instant.ofEpochMilli(2000_000_000)))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ public void testProcessResult_modelSnapshot() {
AutodetectResult result = mock(AutodetectResult.class);
ModelSnapshot modelSnapshot = new ModelSnapshot.Builder(JOB_ID)
.setSnapshotId("a_snapshot_id")
.setTimestamp(Date.from(Instant.ofEpochMilli(1000000000)))
.setLatestResultTimeStamp(Date.from(Instant.ofEpochMilli(1000_000_000)))
.setTimestamp(Date.from(Instant.ofEpochMilli(2000_000_000)))
.setMinVersion(Version.CURRENT)
.build();
when(result.getModelSnapshot()).thenReturn(modelSnapshot);
Expand All @@ -389,8 +390,8 @@ public void testProcessResult_modelSnapshot() {
"Job model snapshot with id [a_snapshot_id] stored",
Date.from(CURRENT_TIME),
XPackUser.NAME,
modelSnapshot.getTimestamp(),
modelSnapshot.getTimestamp(),
Date.from(Instant.ofEpochMilli(1000_000_000)),
Date.from(Instant.ofEpochMilli(1000_000_000)),
JOB_ID,
Date.from(CURRENT_TIME),
XPackUser.NAME,
Expand Down