diff options
Diffstat (limited to 'node-admin')
2 files changed, 7 insertions, 5 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java index de00b119cd0..eabf38d5f64 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java @@ -6,6 +6,7 @@ import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext; import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult; import java.io.IOException; +import java.nio.file.Path; import java.util.List; import java.util.logging.Logger; import java.util.stream.Collectors; @@ -45,5 +46,10 @@ abstract class AbstractProducer implements ArtifactProducer { return result; } + protected int findVespaServicePid(NodeAgentContext ctx, String configId) throws IOException { + Path findPidBinary = ctx.pathInNodeUnderVespaHome("libexec/vespa/find-pid"); + CommandResult findPidResult = executeCommand(ctx, List.of(findPidBinary.toString(), configId), true); + return Integer.parseInt(findPidResult.getOutput()); + } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReportProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReportProducer.java index f2725f4ba45..1407153f50f 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReportProducer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReportProducer.java @@ -4,10 +4,8 @@ package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump; import com.yahoo.vespa.hosted.node.admin.container.ContainerOperations; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext; import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixPath; -import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult; import java.io.IOException; -import java.nio.file.Path; import java.util.ArrayList; import java.util.List; @@ -25,9 +23,7 @@ class PerfReportProducer extends AbstractProducer { @Override public void produceArtifact(NodeAgentContext context, String configId, ServiceDumpReport.DumpOptions options, UnixPath resultDirectoryInNode) throws IOException { - Path findPidBinary = context.pathInNodeUnderVespaHome("libexec/vespa/find-pid"); - CommandResult findPidResult = executeCommand(context, List.of(findPidBinary.toString(), configId), true); - String pid = findPidResult.getOutput(); + int pid = findVespaServicePid(context, configId); int duration = options != null && options.duration() != null && options.duration() > 0 ? options.duration().intValue() : 30; List<String> perfRecordCommand = new ArrayList<>(List.of("perf", "record")); |