use of org.apache.flink.runtime.rest.messages.checkpoints.StatsSummaryDto in project flink by apache.
the class TaskCheckpointStatisticDetailsHandler method createSummary.
private static TaskCheckpointStatisticsWithSubtaskDetails.Summary createSummary(TaskStateStats.TaskStateStatsSummary taskStatisticsSummary, long triggerTimestamp) {
final StatsSummary ackTSStats = taskStatisticsSummary.getAckTimestampStats();
final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration checkpointDuration = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointDuration(StatsSummaryDto.valueOf(taskStatisticsSummary.getSyncCheckpointDurationStats()), StatsSummaryDto.valueOf(taskStatisticsSummary.getAsyncCheckpointDurationStats()));
final TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment checkpointAlignment = new TaskCheckpointStatisticsWithSubtaskDetails.CheckpointAlignment(new StatsSummaryDto(0, 0, 0, 0, 0, 0, 0, 0), StatsSummaryDto.valueOf(taskStatisticsSummary.getProcessedDataStats()), StatsSummaryDto.valueOf(taskStatisticsSummary.getPersistedDataStats()), StatsSummaryDto.valueOf(taskStatisticsSummary.getAlignmentDurationStats()));
return new TaskCheckpointStatisticsWithSubtaskDetails.Summary(StatsSummaryDto.valueOf(taskStatisticsSummary.getCheckpointedSize()), StatsSummaryDto.valueOf(taskStatisticsSummary.getStateSizeStats()), new StatsSummaryDto(Math.max(0L, ackTSStats.getMinimum() - triggerTimestamp), Math.max(0L, ackTSStats.getMaximum() - triggerTimestamp), Math.max(0L, ackTSStats.getAverage() - triggerTimestamp), ackTSStats.createSnapshot().getQuantile(.50d), ackTSStats.createSnapshot().getQuantile(.90d), ackTSStats.createSnapshot().getQuantile(.95d), ackTSStats.createSnapshot().getQuantile(.99d), ackTSStats.createSnapshot().getQuantile(.999d)), checkpointDuration, checkpointAlignment, StatsSummaryDto.valueOf(taskStatisticsSummary.getCheckpointStartDelayStats()));
}
use of org.apache.flink.runtime.rest.messages.checkpoints.StatsSummaryDto in project flink by apache.
the class CheckpointingStatisticsHandler method createCheckpointingStatistics.
private static CheckpointingStatistics createCheckpointingStatistics(AccessExecutionGraph executionGraph) throws RestHandlerException {
final CheckpointStatsSnapshot checkpointStatsSnapshot = executionGraph.getCheckpointStatsSnapshot();
if (checkpointStatsSnapshot == null) {
throw new RestHandlerException("Checkpointing has not been enabled.", HttpResponseStatus.NOT_FOUND, RestHandlerException.LoggingBehavior.IGNORE);
} else {
final CheckpointStatsCounts checkpointStatsCounts = checkpointStatsSnapshot.getCounts();
final CheckpointingStatistics.Counts counts = new CheckpointingStatistics.Counts(checkpointStatsCounts.getNumberOfRestoredCheckpoints(), checkpointStatsCounts.getTotalNumberOfCheckpoints(), checkpointStatsCounts.getNumberOfInProgressCheckpoints(), checkpointStatsCounts.getNumberOfCompletedCheckpoints(), checkpointStatsCounts.getNumberOfFailedCheckpoints());
final CompletedCheckpointStatsSummarySnapshot checkpointStatsSummary = checkpointStatsSnapshot.getSummaryStats();
final CheckpointingStatistics.Summary summary = new CheckpointingStatistics.Summary(StatsSummaryDto.valueOf(checkpointStatsSummary.getCheckpointedSize()), StatsSummaryDto.valueOf(checkpointStatsSummary.getStateSizeStats()), StatsSummaryDto.valueOf(checkpointStatsSummary.getEndToEndDurationStats()), new StatsSummaryDto(0, 0, 0, 0, 0, 0, 0, 0), StatsSummaryDto.valueOf(checkpointStatsSummary.getProcessedDataStats()), StatsSummaryDto.valueOf(checkpointStatsSummary.getPersistedDataStats()));
final CheckpointStatsHistory checkpointStatsHistory = checkpointStatsSnapshot.getHistory();
final CheckpointStatistics.CompletedCheckpointStatistics completed = checkpointStatsHistory.getLatestCompletedCheckpoint() != null ? (CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(checkpointStatsHistory.getLatestCompletedCheckpoint(), false) : null;
final CheckpointStatistics.CompletedCheckpointStatistics savepoint = checkpointStatsHistory.getLatestSavepoint() != null ? (CheckpointStatistics.CompletedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(checkpointStatsHistory.getLatestSavepoint(), false) : null;
final CheckpointStatistics.FailedCheckpointStatistics failed = checkpointStatsHistory.getLatestFailedCheckpoint() != null ? (CheckpointStatistics.FailedCheckpointStatistics) CheckpointStatistics.generateCheckpointStatistics(checkpointStatsHistory.getLatestFailedCheckpoint(), false) : null;
final RestoredCheckpointStats restoredCheckpointStats = checkpointStatsSnapshot.getLatestRestoredCheckpoint();
final CheckpointingStatistics.RestoredCheckpointStatistics restored;
if (restoredCheckpointStats == null) {
restored = null;
} else {
restored = new CheckpointingStatistics.RestoredCheckpointStatistics(restoredCheckpointStats.getCheckpointId(), restoredCheckpointStats.getRestoreTimestamp(), restoredCheckpointStats.getProperties().isSavepoint(), restoredCheckpointStats.getExternalPath());
}
final CheckpointingStatistics.LatestCheckpoints latestCheckpoints = new CheckpointingStatistics.LatestCheckpoints(completed, savepoint, failed, restored);
final List<CheckpointStatistics> history = new ArrayList<>(16);
for (AbstractCheckpointStats abstractCheckpointStats : checkpointStatsSnapshot.getHistory().getCheckpoints()) {
history.add(CheckpointStatistics.generateCheckpointStatistics(abstractCheckpointStats, false));
}
return new CheckpointingStatistics(counts, summary, latestCheckpoints, history);
}
}
Aggregations