Search in sources :

Example 1 with QueryMetadata

use of io.prestosql.spi.eventlistener.QueryMetadata in project hetu-core by openlookeng.

the class QueryMonitor method queryImmediateFailureEvent.

public void queryImmediateFailureEvent(BasicQueryInfo queryInfo, ExecutionFailureInfo failure) {
    eventListenerManager.queryCompleted(new QueryCompletedEvent(new QueryMetadata(queryInfo.getQueryId().toString(), queryInfo.getSession().getTransactionId().map(TransactionId::toString), queryInfo.getQuery(), queryInfo.getPreparedQuery(), queryInfo.getState().toString(), queryInfo.getSelf(), Optional.empty(), Optional.empty()), new QueryStatistics(ofMillis(0), ofMillis(0), ofMillis(queryInfo.getQueryStats().getQueuedTime().toMillis()), Optional.empty(), Optional.empty(), Optional.empty(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImmutableList.of(), 0, true, ImmutableList.of(), ImmutableList.of(), Optional.empty()), createQueryContext(queryInfo.getSession(), queryInfo.getResourceGroupId()), new QueryIOMetadata(ImmutableList.of(), Optional.empty()), createQueryFailureInfo(failure, Optional.empty()), ImmutableList.of(), ofEpochMilli(queryInfo.getQueryStats().getCreateTime().getMillis()), ofEpochMilli(queryInfo.getQueryStats().getEndTime().getMillis()), ofEpochMilli(queryInfo.getQueryStats().getEndTime().getMillis())));
    logQueryTimeline(queryInfo);
}
Also used : QueryMetadata(io.prestosql.spi.eventlistener.QueryMetadata) QueryCompletedEvent(io.prestosql.spi.eventlistener.QueryCompletedEvent) QueryStatistics(io.prestosql.spi.eventlistener.QueryStatistics) QueryIOMetadata(io.prestosql.spi.eventlistener.QueryIOMetadata)

Example 2 with QueryMetadata

use of io.prestosql.spi.eventlistener.QueryMetadata in project hetu-core by openlookeng.

the class EventUtility method visit.

private static void visit(QueryCompletedEvent event, BiConsumer<String, Object> consumer) {
    QueryMetadata metadata = event.getMetadata();
    QueryContext context = event.getContext();
    QueryStatistics statistics = event.getStatistics();
    consumer.accept(QUERY_ID, metadata.getQueryId());
    consumer.accept("Query", metadata.getQuery());
    consumer.accept(CREATE_TIME, event.getCreateTime());
    consumer.accept("Execution Start Time", event.getExecutionStartTime());
    consumer.accept("End Time", event.getEndTime());
    consumer.accept("Wall Time", statistics.getWallTime().toMillis());
    consumer.accept("User", context.getUser());
    consumer.accept("Complete", statistics.isComplete());
    context.getRemoteClientAddress().ifPresent(address -> consumer.accept("Remote Client Address", address));
    context.getCatalog().ifPresent(catalog -> consumer.accept("Catalog", catalog));
    context.getSchema().ifPresent(schema -> consumer.accept("Schema", schema));
    event.getFailureInfo().ifPresent(failureInfo -> {
        consumer.accept("Query Failure Error", failureInfo.getErrorCode());
        failureInfo.getFailureType().ifPresent(type -> consumer.accept(QUERY_FAILURE_TYPE, type));
        failureInfo.getFailureMessage().ifPresent(message -> consumer.accept(QUERY_FAILURE_TYPE, message));
        failureInfo.getFailureTask().ifPresent(task -> consumer.accept(QUERY_FAILURE_TYPE, task));
        failureInfo.getFailureHost().ifPresent(host -> consumer.accept(QUERY_FAILURE_TYPE, host));
    });
}
Also used : QueryMetadata(io.prestosql.spi.eventlistener.QueryMetadata) QueryStatistics(io.prestosql.spi.eventlistener.QueryStatistics) QueryContext(io.prestosql.spi.eventlistener.QueryContext)

Example 3 with QueryMetadata

use of io.prestosql.spi.eventlistener.QueryMetadata in project hetu-core by openlookeng.

the class EventUtility method visit.

private static void visit(QueryCreatedEvent event, BiConsumer<String, Object> consumer) {
    QueryMetadata metadata = event.getMetadata();
    QueryContext context = event.getContext();
    consumer.accept(QUERY_ID, metadata.getQueryId());
    consumer.accept("Query", metadata.getQuery());
    consumer.accept(CREATE_TIME, event.getCreateTime());
    consumer.accept("User", context.getUser());
    context.getRemoteClientAddress().ifPresent(address -> consumer.accept("Remote Client Address", address));
    context.getCatalog().ifPresent(catalog -> consumer.accept("Catalog", catalog));
    context.getSchema().ifPresent(schema -> consumer.accept("Schema", schema));
}
Also used : QueryMetadata(io.prestosql.spi.eventlistener.QueryMetadata) QueryContext(io.prestosql.spi.eventlistener.QueryContext)

Aggregations

QueryMetadata (io.prestosql.spi.eventlistener.QueryMetadata)3 QueryContext (io.prestosql.spi.eventlistener.QueryContext)2 QueryStatistics (io.prestosql.spi.eventlistener.QueryStatistics)2 QueryCompletedEvent (io.prestosql.spi.eventlistener.QueryCompletedEvent)1 QueryIOMetadata (io.prestosql.spi.eventlistener.QueryIOMetadata)1