diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-08-31 16:32:55 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-08-31 16:32:55 +0200 |
commit | 5963ab60ccbd1df1597d9f2a9a8b3c5cbf3a11bd (patch) | |
tree | ae7732d87087e36517ff6c92a965d50396b809e1 /node-admin | |
parent | b9c376131bdfa38adfbf5e70465645c022582fd1 (diff) |
Use existing 'createdMillis' instead of 'requestedAt'
Diffstat (limited to 'node-admin')
2 files changed, 11 insertions, 11 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ServiceDumpReport.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ServiceDumpReport.java index bbe46e637c8..850482fc186 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ServiceDumpReport.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ServiceDumpReport.java @@ -19,7 +19,6 @@ class ServiceDumpReport extends BaseReport { public static final String REPORT_ID = "serviceDump"; - private static final String REQUESTED_AT_FIELD = "requestedAt"; private static final String STARTED_AT_FIELD = "startedAt"; private static final String COMPLETED_AT_FIELD = "completedAt"; private static final String FAILED_AT_FIELD = "failedAt"; @@ -28,7 +27,6 @@ class ServiceDumpReport extends BaseReport { private static final String EXPIRE_AT_FIELD = "expireAt"; private static final String ERROR_FIELD = "error"; - private final Long requestedAt; private final Long startedAt; private final Long completedAt; private final Long failedAt; @@ -38,7 +36,7 @@ class ServiceDumpReport extends BaseReport { private final String error; @JsonCreator - public ServiceDumpReport(@JsonProperty(REQUESTED_AT_FIELD) Long requestedAt, + public ServiceDumpReport(@JsonProperty(CREATED_FIELD) Long createdAt, @JsonProperty(STARTED_AT_FIELD) Long startedAt, @JsonProperty(COMPLETED_AT_FIELD) Long completedAt, @JsonProperty(FAILED_AT_FIELD) Long failedAt, @@ -46,8 +44,7 @@ class ServiceDumpReport extends BaseReport { @JsonProperty(CONFIG_ID_FIELD) String configId, @JsonProperty(EXPIRE_AT_FIELD) Long expireAt, @JsonProperty(ERROR_FIELD) String error) { - super(null, null); - this.requestedAt = requestedAt; + super(createdAt, null); this.startedAt = startedAt; this.completedAt = completedAt; this.failedAt = failedAt; @@ -57,7 +54,6 @@ class ServiceDumpReport extends BaseReport { this.error = error; } - @JsonGetter(REQUESTED_AT_FIELD) public Long requestedAt() { return requestedAt; } @JsonGetter(STARTED_AT_FIELD) public Long startedAt() { return startedAt; } @JsonGetter(COMPLETED_AT_FIELD) public Long completedAt() { return completedAt; } @JsonGetter(FAILED_AT_FIELD) public Long failedAt() { return failedAt; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java index c4031e77daf..d2cf652a9d9 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java @@ -51,6 +51,10 @@ public class VespaServiceDumperImpl implements VespaServiceDumper { context.log(log, Level.FINE, "No service dump requested or dump already completed/failed"); return; } + if (isNullTimestamp(request.getCreatedMillisOrNull())) { + handleFailure(context, request, startedAt, null, "'createdMillis' is missing or null"); + return; + } String configId = request.configId(); if (configId == null) { handleFailure(context, request, startedAt, null, "Service config id is missing from request"); @@ -63,7 +67,7 @@ public class VespaServiceDumperImpl implements VespaServiceDumper { } try { context.log(log, Level.FINE, - "Creating dump for " + configId + " requested at " + Instant.ofEpochMilli(request.requestedAt())); + "Creating dump for " + configId + " requested at " + Instant.ofEpochMilli(request.getCreatedMillisOrNull())); storeReport(context, createStartedReport(request, startedAt)); Path directoryOnHost = context.pathOnHostFromPathInNode(DIRECTORY_IN_NODE); Files.deleteIfExists(directoryOnHost); @@ -131,19 +135,19 @@ public class VespaServiceDumperImpl implements VespaServiceDumper { private static ServiceDumpReport createStartedReport(ServiceDumpReport request, Instant startedAt) { return new ServiceDumpReport( - request.requestedAt(), startedAt.toEpochMilli(), null, null, null, request.configId(), + request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), null, null, null, request.configId(), request.expireAt(), null); } private static ServiceDumpReport createSuccessReport(ServiceDumpReport request, Instant startedAt, URI location) { return new ServiceDumpReport( - request.requestedAt(), startedAt.toEpochMilli(), Instant.now().toEpochMilli(), null, + request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), Instant.now().toEpochMilli(), null, location.toString(), request.configId(), request.expireAt(), null); } private static ServiceDumpReport createErrorReport(ServiceDumpReport request, Instant startedAt, String message) { return new ServiceDumpReport( - request.requestedAt(), startedAt.toEpochMilli(), null, Instant.now().toEpochMilli(), null, + request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), null, Instant.now().toEpochMilli(), null, request.configId(), request.expireAt(), message); } @@ -151,7 +155,7 @@ public class VespaServiceDumperImpl implements VespaServiceDumper { String sanitizedConfigId = report.configId() .replace('/', '-') .replace('@', '-'); - return sanitizedConfigId + "-" + report.requestedAt().toString(); + return sanitizedConfigId + "-" + report.getCreatedMillisOrNull().toString(); } private static URI serviceDumpDestination(NodeSpec spec, String dumpId) { |