summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java
diff options
context:
space:
mode:
Diffstat (limited to 'node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java51
1 files changed, 0 insertions, 51 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java
deleted file mode 100644
index 4d2b9d10069..00000000000
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JavaFlightRecorder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
-
-import com.yahoo.yolean.concurrent.Sleeper;
-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 java.io.IOException;
-import java.time.Duration;
-import java.util.List;
-
-/**
- * Creates a Java Flight Recorder dump.
- *
- * @author bjorncs
- */
-class JavaFlightRecorder extends AbstractProducer {
-
- private final Sleeper sleeper;
-
- JavaFlightRecorder(ContainerOperations container, Sleeper sleeper) {
- super(container);
- this.sleeper = sleeper;
- }
-
- static String NAME = "jfr-recording";
-
- @Override public String name() { return NAME; }
-
- @Override
- public void produceArtifact(NodeAgentContext ctx, String configId, ServiceDumpReport.DumpOptions options,
- UnixPath resultDirectoryInNode) throws IOException {
- int pid = findVespaServicePid(ctx, configId);
- int seconds = (int) (duration(ctx, options, 30.0));
- UnixPath outputFile = resultDirectoryInNode.resolve("recording.jfr");
- List<String> startCommand = List.of("jcmd", Integer.toString(pid), "JFR.start", "name=host-admin",
- "path-to-gc-roots=true", "settings=profile", "filename=" + outputFile, "duration=" + seconds + "s");
- executeCommand(ctx, startCommand, true);
- sleeper.sleep(Duration.ofSeconds(seconds).plusSeconds(1));
- int maxRetries = 10;
- List<String> checkCommand = List.of("jcmd", Integer.toString(pid), "JFR.check", "name=host-admin");
- for (int i = 0; i < maxRetries; i++) {
- boolean stillRunning = executeCommand(ctx, checkCommand, true).getOutputLines().stream()
- .anyMatch(l -> l.contains("name=host-admin") && l.contains("running"));
- if (!stillRunning) return;
- sleeper.sleep(Duration.ofSeconds(1));
- }
- throw new IOException("Failed to wait for JFR dump to complete after " + maxRetries + " retries");
- }
-}