summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-09-13 11:13:58 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-09-13 16:37:21 +0200
commit91b7b0072046faa0611d4383feba14dfff0509ea (patch)
tree333b834c428c96c1d116b9be81d61777d8adc503 /node-admin
parent4d71854046513bc7e7756b978a155f16be4aabf4 (diff)
Add extra dump options field to service dump report
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java4
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumpProducer.java3
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ServiceDumpReport.java28
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java8
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java4
5 files changed, 38 insertions, 9 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
index 24f070bbc35..83e83f1f4d2 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
@@ -15,6 +15,8 @@ interface ArtifactProducer {
String name();
- void produceArtifact(NodeAgentContext context, String configId, UnixPath resultDirectoryInNode) throws IOException;
+ void produceArtifact(NodeAgentContext context, String configId, ServiceDumpReport.DumpOptions options,
+ UnixPath resultDirectoryInNode) throws IOException;
+
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumpProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumpProducer.java
index bc7703ba03a..014ad10beb6 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumpProducer.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumpProducer.java
@@ -28,7 +28,8 @@ class JvmDumpProducer implements ArtifactProducer {
@Override public String name() { return NAME; }
@Override
- public void produceArtifact(NodeAgentContext context, String configId, UnixPath resultDirectoryInNode) throws IOException {
+ public void produceArtifact(NodeAgentContext context, String configId, ServiceDumpReport.DumpOptions options,
+ UnixPath resultDirectoryInNode) throws IOException {
UnixPath vespaJvmDumper = new UnixPath(context.pathInNodeUnderVespaHome("bin/vespa-jvm-dumper"));
context.log(log, Level.INFO,
"Executing '" + vespaJvmDumper + "' with arguments '" + configId + "' and '" + resultDirectoryInNode + "'");
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 6ff4929ada1..2d7d21e61e4 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
@@ -30,6 +30,7 @@ class ServiceDumpReport extends BaseReport {
private static final String EXPIRE_AT_FIELD = "expireAt";
private static final String ERROR_FIELD = "error";
private static final String ARTIFACTS_FIELD = "artifacts";
+ private static final String DUMP_OPTIONS_FIELD = "dumpOptions";
private final Long startedAt;
private final Long completedAt;
@@ -39,6 +40,7 @@ class ServiceDumpReport extends BaseReport {
private final Long expireAt;
private final String error;
private final List<String> artifacts;
+ private final DumpOptions dumpOptions;
@JsonCreator
public ServiceDumpReport(@JsonProperty(CREATED_FIELD) Long createdAt,
@@ -49,7 +51,8 @@ class ServiceDumpReport extends BaseReport {
@JsonProperty(CONFIG_ID_FIELD) String configId,
@JsonProperty(EXPIRE_AT_FIELD) Long expireAt,
@JsonProperty(ERROR_FIELD) String error,
- @JsonProperty(ARTIFACTS_FIELD) List<String> artifacts) {
+ @JsonProperty(ARTIFACTS_FIELD) List<String> artifacts,
+ @JsonProperty(DUMP_OPTIONS_FIELD) DumpOptions dumpOptions) {
super(createdAt, null);
this.startedAt = startedAt;
this.completedAt = completedAt;
@@ -59,6 +62,7 @@ class ServiceDumpReport extends BaseReport {
this.expireAt = expireAt;
this.error = error;
this.artifacts = artifacts;
+ this.dumpOptions = dumpOptions;
}
@JsonGetter(STARTED_AT_FIELD) public Long startedAt() { return startedAt; }
@@ -69,6 +73,28 @@ class ServiceDumpReport extends BaseReport {
@JsonGetter(EXPIRE_AT_FIELD) public Long expireAt() { return expireAt; }
@JsonGetter(ERROR_FIELD) public String error() { return error; }
@JsonGetter(ARTIFACTS_FIELD) public List<String> artifacts() { return artifacts; }
+ @JsonGetter(DUMP_OPTIONS_FIELD) public DumpOptions dumpOptions() { return dumpOptions; }
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class DumpOptions {
+
+ private static final String CALL_GRAPH_RECORDING_FIELD = "callGraphRecording";
+ private static final String DURATION_FIELD = "duration";
+
+ private final Boolean callGraphRecording;
+ private final Double duration;
+
+ @JsonCreator
+ public DumpOptions(@JsonProperty(CALL_GRAPH_RECORDING_FIELD) Boolean callGraphRecording,
+ @JsonProperty(DURATION_FIELD) Double duration) {
+ this.callGraphRecording = callGraphRecording;
+ this.duration = duration;
+ }
+
+ @JsonGetter(CALL_GRAPH_RECORDING_FIELD) public Boolean callGraphRecording() { return callGraphRecording; }
+ @JsonGetter(DURATION_FIELD) public Double duration() { return duration; }
+ }
@JsonIgnore public boolean isCompletedOrFailed() { return !isNullTimestamp(failedAt) || !isNullTimestamp(completedAt); }
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 f98b47fa604..82616e9fc86 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
@@ -113,7 +113,7 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
producerDirectoryOnHost.createDirectory();
producerDirectoryOnHost.setPermissions("rwxrwxrwx");
UnixPath producerDirectoryInNode = directoryInNode.resolve(artifactType);
- producer.produceArtifact(context, configId, producerDirectoryInNode);
+ producer.produceArtifact(context, configId, request.dumpOptions(), producerDirectoryInNode);
collectArtifactFilesToUpload(files, producerDirectoryOnHost, destination.resolve(artifactType + '/'), expiry);
}
context.log(log, Level.INFO, "Uploading files with destination " + destination + " and expiry " + expiry);
@@ -166,21 +166,21 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
private static ServiceDumpReport createStartedReport(ServiceDumpReport request, Instant startedAt) {
return new ServiceDumpReport(
request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), null, null, null, request.configId(),
- request.expireAt(), null, request.artifacts());
+ request.expireAt(), null, request.artifacts(), request.dumpOptions());
}
private static ServiceDumpReport createSuccessReport(
Clock clock, ServiceDumpReport request, Instant startedAt, URI location) {
return new ServiceDumpReport(
request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), clock.instant().toEpochMilli(), null,
- location.toString(), request.configId(), request.expireAt(), null, request.artifacts());
+ location.toString(), request.configId(), request.expireAt(), null, request.artifacts(), request.dumpOptions());
}
private static ServiceDumpReport createErrorReport(
Clock clock, ServiceDumpReport request, Instant startedAt, String message) {
return new ServiceDumpReport(
request.getCreatedMillisOrNull(), startedAt.toEpochMilli(), null, clock.instant().toEpochMilli(), null,
- request.configId(), request.expireAt(), message, request.artifacts());
+ request.configId(), request.expireAt(), message, request.artifacts(), request.dumpOptions());
}
static String createDumpId(ServiceDumpReport request) {
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java
index 19d7e294367..29ded05c64a 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java
@@ -41,7 +41,7 @@ class VespaServiceDumperImplTest {
void creates_valid_dump_id_from_dump_request() {
long nowMillis = Instant.now().toEpochMilli();
ServiceDumpReport request = new ServiceDumpReport(
- nowMillis, null, null, null, null, "default/container.3", null, null, List.of(JvmDumpProducer.NAME));
+ nowMillis, null, null, null, null, "default/container.3", null, null, List.of(JvmDumpProducer.NAME), null);
String dumpId = VespaServiceDumperImpl.createDumpId(request);
assertEquals("default-container-3-" + nowMillis, dumpId);
}
@@ -59,7 +59,7 @@ class VespaServiceDumperImplTest {
NodeRepoMock nodeRepository = new NodeRepoMock();
ManualClock clock = new ManualClock(Instant.ofEpochMilli(1600001000000L));
ServiceDumpReport request = new ServiceDumpReport(
- 1600000000000L, null, null, null, null, "default/container.1", null, null, List.of(JvmDumpProducer.NAME));
+ 1600000000000L, null, null, null, null, "default/container.1", null, null, List.of(JvmDumpProducer.NAME), null);
NodeSpec initialSpec = NodeSpec.Builder
.testSpec(HOSTNAME, NodeState.active)
.report(ServiceDumpReport.REPORT_ID, request.toJsonNode())