Search in sources :

Example 1 with QueryType

use of com.alibaba.maxgraph.logging.LogEvents.QueryType in project GraphScope by alibaba.

the class MixedOpProcessor method processGraphTraversal.

@Override
protected void processGraphTraversal(String script, Context context, Object traversal, long timeout) {
    String queryId = String.valueOf(ThreadLocalRandom.current().nextLong());
    Stopwatch timer = Stopwatch.createStarted();
    QueryType queryType = QueryType.EXECUTE;
    if (traversal instanceof PreparedTraversal) {
        queryType = QueryType.PREPARE;
    } else if (traversal instanceof PreparedExecuteParam) {
        queryType = QueryType.QUERY;
    }
    Logging.query(this.graphName, com.alibaba.maxgraph.proto.RoleType.FRONTEND, this.serverId, queryId, queryType, QueryEvent.FRONT_RECEIVED, null, null, null, script);
    try {
        Long totalResultNum = doProcessGraphTraversal(script, context, traversal, timeout, queryId, timer);
        Logging.query(this.graphName, com.alibaba.maxgraph.proto.RoleType.FRONTEND, this.serverId, queryId, QueryType.EXECUTE, QueryEvent.FRONT_FINISH, timer.elapsed(TimeUnit.NANOSECONDS), totalResultNum, true, script);
    } catch (Exception e) {
        Logging.query(this.graphName, com.alibaba.maxgraph.proto.RoleType.FRONTEND, this.serverId, queryId, QueryType.EXECUTE, QueryEvent.FRONT_FINISH, timer.elapsed(TimeUnit.NANOSECONDS), null, false, script);
        throw new RuntimeException(e);
    }
}
Also used : PreparedTraversal(com.alibaba.maxgraph.compiler.prepare.PreparedTraversal) Stopwatch(com.google.common.base.Stopwatch) PreparedExecuteParam(com.alibaba.maxgraph.compiler.prepare.PreparedExecuteParam) QueryType(com.alibaba.maxgraph.logging.LogEvents.QueryType) RetryGremlinException(com.alibaba.maxgraph.compiler.exception.RetryGremlinException)

Aggregations

RetryGremlinException (com.alibaba.maxgraph.compiler.exception.RetryGremlinException)1 PreparedExecuteParam (com.alibaba.maxgraph.compiler.prepare.PreparedExecuteParam)1 PreparedTraversal (com.alibaba.maxgraph.compiler.prepare.PreparedTraversal)1 QueryType (com.alibaba.maxgraph.logging.LogEvents.QueryType)1 Stopwatch (com.google.common.base.Stopwatch)1