Search in sources :

Example 1 with DiagnosticsReporter

use of org.neo4j.kernel.diagnostics.DiagnosticsReporter in project neo4j by neo4j.

the class DiagnosticsReportCommand method createAndRegisterSources.

private DiagnosticsReporter createAndRegisterSources(Config config) {
    DiagnosticsReporter reporter = new DiagnosticsReporter();
    Path storeDirectory = config.get(databases_root_path);
    reporter.registerAllOfflineProviders(config, storeDirectory, ctx.fs(), config.get(GraphDatabaseSettings.default_database));
    // Register sources provided by this tool
    reporter.registerSource("config", DiagnosticsReportSources.newDiagnosticsFile("neo4j.conf", ctx.fs(), configFile()));
    reporter.registerSource("ps", runningProcesses());
    // Online connection
    registerJMXSources(reporter);
    return reporter;
}
Also used : Path(java.nio.file.Path) DiagnosticsReporter(org.neo4j.kernel.diagnostics.DiagnosticsReporter)

Example 2 with DiagnosticsReporter

use of org.neo4j.kernel.diagnostics.DiagnosticsReporter in project neo4j by neo4j.

the class DiagnosticsReportCommand method execute.

@Override
public void execute() {
    Config config = getConfig(configFile());
    jmxDumper = new JMXDumper(config, ctx.fs(), ctx.out(), ctx.err(), verbose);
    DiagnosticsReporter reporter = createAndRegisterSources(config);
    if (list) {
        listClassifiers(reporter.getAvailableClassifiers());
        return;
    }
    validateClassifiers(reporter);
    DiagnosticsReporterProgress progress = buildProgress();
    // Start dumping
    try {
        if (reportDir == null) {
            reportDir = Path.of(System.getProperty("java.io.tmpdir")).resolve("reports").toAbsolutePath();
        }
        Path reportFile = reportDir.resolve(getDefaultFilename());
        ctx.out().println("Writing report to " + reportFile.toAbsolutePath());
        reporter.dump(classifiers, reportFile, progress, force);
    } catch (IOException e) {
        throw new CommandFailedException("Creating archive failed", e);
    }
}
Also used : Path(java.nio.file.Path) JMXDumper(org.neo4j.dbms.diagnostics.jmx.JMXDumper) Config(org.neo4j.configuration.Config) DiagnosticsReporterProgress(org.neo4j.kernel.diagnostics.DiagnosticsReporterProgress) DiagnosticsReporter(org.neo4j.kernel.diagnostics.DiagnosticsReporter) IOException(java.io.IOException) CommandFailedException(org.neo4j.cli.CommandFailedException)

Aggregations

Path (java.nio.file.Path)2 DiagnosticsReporter (org.neo4j.kernel.diagnostics.DiagnosticsReporter)2 IOException (java.io.IOException)1 CommandFailedException (org.neo4j.cli.CommandFailedException)1 Config (org.neo4j.configuration.Config)1 JMXDumper (org.neo4j.dbms.diagnostics.jmx.JMXDumper)1 DiagnosticsReporterProgress (org.neo4j.kernel.diagnostics.DiagnosticsReporterProgress)1