Search in sources :

Example 1 with Profiler

use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.

the class MigrationStepsExecutorImpl method execute.

@Override
public void execute(Stream<RegisteredMigrationStep> steps) {
    Profiler globalProfiler = Profiler.create(LOGGER);
    globalProfiler.startInfo(GLOBAL_START_MESSAGE);
    boolean allStepsExecuted = false;
    try {
        steps.forEachOrdered(this::execute);
        allStepsExecuted = true;
    } finally {
        if (allStepsExecuted) {
            globalProfiler.stopInfo(GLOBAL_END_MESSAGE, "success");
        } else {
            globalProfiler.stopError(GLOBAL_END_MESSAGE, "failure");
        }
    }
}
Also used : Profiler(org.sonar.core.util.logs.Profiler)

Example 2 with Profiler

use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.

the class MigrationStepsExecutorImpl method execute.

private void execute(RegisteredMigrationStep step, MigrationStep migrationStep) {
    Profiler stepProfiler = Profiler.create(LOGGER);
    stepProfiler.startInfo(STEP_START_PATTERN, step);
    boolean done = false;
    try {
        migrationStep.execute();
        migrationHistory.done(step);
        done = true;
    } catch (Exception e) {
        throw new MigrationStepExecutionException(step, e);
    } finally {
        if (done) {
            stepProfiler.stopInfo(STEP_STOP_PATTERN, step, "success");
        } else {
            stepProfiler.stopError(STEP_STOP_PATTERN, step, "failure");
        }
    }
}
Also used : Profiler(org.sonar.core.util.logs.Profiler)

Example 3 with Profiler

use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.

the class VisitorsCrawler method visitNode.

private void visitNode(Component component, VisitorWrapper visitor) {
    Profiler profiler = Profiler.create(Loggers.get(visitor.getWrappedVisitor().getClass())).startTrace("Visiting component {}", component.getKey());
    visitor.visitAny(component);
    switch(component.getType()) {
        case PROJECT:
            visitor.visitProject(component);
            break;
        case MODULE:
            visitor.visitModule(component);
            break;
        case DIRECTORY:
            visitor.visitDirectory(component);
            break;
        case FILE:
            visitor.visitFile(component);
            break;
        case VIEW:
            visitor.visitView(component);
            break;
        case SUBVIEW:
            visitor.visitSubView(component);
            break;
        case PROJECT_VIEW:
            visitor.visitProjectView(component);
            break;
        default:
            throw new IllegalStateException(String.format("Unknown type %s", component.getType().name()));
    }
    long duration = profiler.stopTrace();
    incrementDuration(visitor, duration);
}
Also used : Profiler(org.sonar.core.util.logs.Profiler)

Example 4 with Profiler

use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.

the class ComputationStepExecutor method execute.

public void execute() {
    Profiler stepProfiler = Profiler.create(LOGGER);
    boolean allStepsExecuted = false;
    try {
        executeSteps(stepProfiler);
        allStepsExecuted = true;
    } finally {
        if (listener != null) {
            executeListener(allStepsExecuted);
        }
    }
}
Also used : Profiler(org.sonar.core.util.logs.Profiler)

Example 5 with Profiler

use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.

the class DatabaseMigrationImpl method doUpgradeDb.

private void doUpgradeDb() {
    Profiler profiler = Profiler.createIfTrace(LOGGER);
    profiler.startTrace("Starting DB Migration");
    migrationEngine.execute();
    profiler.stopTrace("DB Migration ended");
}
Also used : Profiler(org.sonar.core.util.logs.Profiler)

Aggregations

Profiler (org.sonar.core.util.logs.Profiler)9 Date (java.util.Date)1 CeTaskResult (org.sonar.ce.queue.CeTaskResult)1 CeTaskProcessor (org.sonar.ce.taskprocessor.CeTaskProcessor)1 CeActivityDto (org.sonar.db.ce.CeActivityDto)1 MigrationStepExecutionException (org.sonar.server.platform.db.migration.step.MigrationStepExecutionException)1