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);
}
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));
});
}
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));
}
Aggregations