Search in sources :

Example 1 with ActivityReportingDefinition

use of com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition in project midpoint by Evolveum.

the class StatisticsLogger method logItemCompletion.

public void logItemCompletion(Operation operation, OperationResultStatus resultStatus) {
    long end = operation.getEndTimeMillis();
    TransientActivityRunStatistics current = activityRun.getTransientRunStatistics();
    ActivityPerformanceInformation overall = getOverallStatistics();
    String mainMessage = String.format(Locale.US, "%s of %s%s done with status %s in %,1f ms.", activityRun.getShortName(), operation.getIterationItemInformation(), activityRun.getContextDescriptionSpaced(), resultStatus, operation.getDurationRounded());
    String counts = String.format(Locale.US, " Items processed in current run: %,d (%,d overall), errors: %,d (%,d overall).", current.getItemsProcessed(), overall.getItemsProcessed(), current.getErrors(), overall.getErrors());
    String throughput;
    Double overallThroughput = overall.getThroughput();
    if (overallThroughput != null) {
        throughput = String.format(Locale.US, " Overall throughput: %,.1f items per minute.", overallThroughput);
    } else {
        throughput = "";
    }
    String mainMessageAddition = counts + throughput;
    String fullStats = getFullStatMessage(overall, end);
    log(ActivityReportingDefinition::getItemCompletionLogging, mainMessage, mainMessageAddition, fullStats);
}
Also used : ActivityReportingDefinition(com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition) ActivityPerformanceInformation(com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)

Example 2 with ActivityReportingDefinition

use of com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition in project midpoint by Evolveum.

the class StatisticsLogger method logBucketCompletion.

void logBucketCompletion(boolean complete) {
    TransientActivityRunStatistics current = activityRun.getTransientRunStatistics();
    long end = System.currentTimeMillis();
    ActivityPerformanceInformation overall = getOverallStatistics();
    RunningTask task = activityRun.getRunningTask();
    String mainMessage = String.format("%s bucket #%d for %s (%s in %s).%s", complete ? "Completed" : "Partially processed", activityRun.getBucket().getSequentialNumber(), activityRun.getShortNameUncapitalized(), activityRun.getActivityPath().toDebugName(), task, complete ? "" : " Bucket processing was interrupted.");
    String currentBrief = String.format(Locale.US, "Current run: processed %,d objects in %.1f seconds, got %,d errors.", current.getItemsProcessed(), current.getWallClockTime(end) / 1000.0, current.getErrors());
    if (current.getItemsProcessed() > 0) {
        currentBrief += String.format(Locale.US, " Average processing time for one object: %,.1f milliseconds. " + "Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.", current.getAverageTime(), current.getAverageWallClockTime(end), current.getThroughput(end));
    }
    Long wallClockTime = overall.getWallClockTime();
    // Wall-clock time information is not available e.g. for activities with persistent state (like LiveSync)
    boolean hasWallClockTime = wallClockTime != null && wallClockTime > 0;
    String wallClockTimeString;
    if (hasWallClockTime) {
        wallClockTimeString = String.format(Locale.US, " in %.1f seconds", ActivityItemProcessingStatisticsUtil.toSeconds(wallClockTime));
    } else {
        wallClockTimeString = "";
    }
    String overallBrief = String.format(Locale.US, "Overall: processed %,d objects%s, got %,d errors. Real progress: %,d.", overall.getItemsProcessed(), wallClockTimeString, overall.getErrors(), overall.getProgress());
    if (overall.getItemsProcessed() > 0) {
        overallBrief += String.format(Locale.US, " Average processing time for one object: %,.1f milliseconds.", overall.getAverageTime());
        if (hasWallClockTime && overall.getAverageWallClockTime() != null) {
            overallBrief += String.format(Locale.US, " Wall clock average: %,.1f milliseconds, throughput: %,.1f items per minute.", overall.getAverageWallClockTime(), overall.getThroughput());
        }
    }
    String mainMessageAddition = "\n" + currentBrief + "\n" + overallBrief;
    String fullStats = getFullStatMessage(overall, end);
    log(ActivityReportingDefinition::getBucketCompletionLogging, mainMessage, mainMessageAddition, fullStats);
}
Also used : ActivityReportingDefinition(com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition) RunningTask(com.evolveum.midpoint.task.api.RunningTask) ActivityPerformanceInformation(com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)

Aggregations

ActivityReportingDefinition (com.evolveum.midpoint.repo.common.activity.definition.ActivityReportingDefinition)2 ActivityPerformanceInformation (com.evolveum.midpoint.schema.util.task.ActivityPerformanceInformation)2 RunningTask (com.evolveum.midpoint.task.api.RunningTask)1