Search in sources :

Example 1 with SplitFailureInfo

use of com.facebook.presto.spi.eventlistener.SplitFailureInfo in project presto by prestodb.

the class QueryMonitor method splitCompletedEvent.

private void splitCompletedEvent(TaskId taskId, DriverStats driverStats, @Nullable String failureType, @Nullable String failureMessage) {
    Optional<Duration> timeToStart = Optional.empty();
    if (driverStats.getStartTime() != null) {
        timeToStart = Optional.of(ofMillis(driverStats.getStartTime().getMillis() - driverStats.getCreateTime().getMillis()));
    }
    Optional<Duration> timeToEnd = Optional.empty();
    if (driverStats.getEndTime() != null) {
        timeToEnd = Optional.of(ofMillis(driverStats.getEndTime().getMillis() - driverStats.getCreateTime().getMillis()));
    }
    Optional<SplitFailureInfo> splitFailureMetadata = Optional.empty();
    if (failureType != null) {
        splitFailureMetadata = Optional.of(new SplitFailureInfo(failureType, failureMessage != null ? failureMessage : ""));
    }
    try {
        eventListenerManager.splitCompleted(new SplitCompletedEvent(taskId.getQueryId().toString(), taskId.getStageId().toString(), Integer.toString(taskId.getId()), driverStats.getCreateTime().toDate().toInstant(), Optional.ofNullable(driverStats.getStartTime()).map(startTime -> startTime.toDate().toInstant()), Optional.ofNullable(driverStats.getEndTime()).map(endTime -> endTime.toDate().toInstant()), new SplitStatistics(ofMillis(driverStats.getTotalCpuTime().toMillis()), ofMillis(driverStats.getElapsedTime().toMillis()), ofMillis(driverStats.getQueuedTime().toMillis()), ofMillis(driverStats.getTotalUserTime().toMillis()), ofMillis(driverStats.getRawInputReadTime().toMillis()), driverStats.getRawInputPositions(), driverStats.getRawInputDataSize().toBytes(), driverStats.getPeakMemoryReservation().toBytes(), timeToStart, timeToEnd), splitFailureMetadata, objectMapper.writeValueAsString(driverStats)));
    } catch (JsonProcessingException e) {
        log.error(e, "Error processing split completion event for task %s", taskId);
    }
}
Also used : SplitCompletedEvent(com.facebook.presto.spi.eventlistener.SplitCompletedEvent) SplitStatistics(com.facebook.presto.spi.eventlistener.SplitStatistics) SplitFailureInfo(com.facebook.presto.spi.eventlistener.SplitFailureInfo) Duration(java.time.Duration) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 2 with SplitFailureInfo

use of com.facebook.presto.spi.eventlistener.SplitFailureInfo in project presto by prestodb.

the class SplitMonitor method splitCompletedEvent.

private void splitCompletedEvent(TaskId taskId, DriverStats driverStats, @Nullable String failureType, @Nullable String failureMessage) {
    Optional<Duration> timeToStart = Optional.empty();
    if (driverStats.getStartTime() != null) {
        timeToStart = Optional.of(ofMillis(driverStats.getStartTime().getMillis() - driverStats.getCreateTime().getMillis()));
    }
    Optional<Duration> timeToEnd = Optional.empty();
    if (driverStats.getEndTime() != null) {
        timeToEnd = Optional.of(ofMillis(driverStats.getEndTime().getMillis() - driverStats.getCreateTime().getMillis()));
    }
    Optional<SplitFailureInfo> splitFailureMetadata = Optional.empty();
    if (failureType != null) {
        splitFailureMetadata = Optional.of(new SplitFailureInfo(failureType, failureMessage != null ? failureMessage : ""));
    }
    try {
        eventListenerManager.splitCompleted(new SplitCompletedEvent(taskId.getQueryId().toString(), taskId.getStageExecutionId().getStageId().toString(), taskId.getStageExecutionId().toString(), Integer.toString(taskId.getId()), driverStats.getCreateTime().toDate().toInstant(), Optional.ofNullable(driverStats.getStartTime()).map(startTime -> startTime.toDate().toInstant()), Optional.ofNullable(driverStats.getEndTime()).map(endTime -> endTime.toDate().toInstant()), new SplitStatistics(ofMillis(driverStats.getTotalCpuTime().toMillis()), ofMillis(driverStats.getElapsedTime().toMillis()), ofMillis(driverStats.getQueuedTime().toMillis()), ofMillis(driverStats.getRawInputReadTime().toMillis()), driverStats.getRawInputPositions(), driverStats.getRawInputDataSize().toBytes(), timeToStart, timeToEnd), splitFailureMetadata, objectMapper.writeValueAsString(driverStats)));
    } catch (JsonProcessingException e) {
        log.error(e, "Error processing split completion event for task %s", taskId);
    }
}
Also used : SplitCompletedEvent(com.facebook.presto.spi.eventlistener.SplitCompletedEvent) SplitStatistics(com.facebook.presto.spi.eventlistener.SplitStatistics) SplitFailureInfo(com.facebook.presto.spi.eventlistener.SplitFailureInfo) Duration(java.time.Duration) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

SplitCompletedEvent (com.facebook.presto.spi.eventlistener.SplitCompletedEvent)2 SplitFailureInfo (com.facebook.presto.spi.eventlistener.SplitFailureInfo)2 SplitStatistics (com.facebook.presto.spi.eventlistener.SplitStatistics)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 Duration (java.time.Duration)2