private Query createQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { Query query; if (statement instanceof SelectStatement) { query = createQuery(startTime, execTime, queryString, (SelectStatement) statement, queryState, options); } else if (statement instanceof ModificationStatement) { query = createQuery(startTime, execTime, queryString, (ModificationStatement) statement, queryState, options); } else { query = createGenericQuery(startTime, execTime, queryString, statement, queryState, options); } return query; }
/** * Wrapper for * {@link org.apache.cassandra.cql3.QueryProcessor#processPrepared(CQLStatement, QueryState, QueryOptions)} method. * This method is invoked after the original method, measures the execution time and reports query. * * @param statement QueryProcessor#processPrepared(CQLStatement, QueryState, QueryOptions) * @param queryState QueryProcessor#processPrepared(CQLStatement, QueryState, QueryOptions) * @param options QueryProcessor#processPrepared(CQLStatement, QueryState, QueryOptions) * @param startTime query execution start time * @param result statement execution result * @param preparedStatements QueryProcessor's internal list of prepared statements */ public void processPrepared(CQLStatement statement, QueryState queryState, QueryOptions options, long startTime, ResultMessage result, ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { final long execTime = System.currentTimeMillis() - startTime; report(startTime, execTime, null, statement, queryState, options, preparedStatements); }
private Query createGenericQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(), Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options)); }
/** * Initialize connector instance using the provided instrumentation. * * @param inst Instrumentation reference * @param queryReporter QueryReporter implementation reference * @param configuration connector specific configuration * @param globalConfiguration global configuration general for diagnostics */ public void init(Instrumentation inst, QueryReporter queryReporter, ConnectorConfiguration configuration, GlobalConfiguration globalConfiguration) { ConnectorImpl.configuration = configuration; ConnectorImpl.globalConfiguration = globalConfiguration; queryProcessorWrapper = new QueryProcessorWrapper(queryReporter, configuration); setQueryProcessorIntercepter(inst); setCassandraDaemonIntercepter(inst); }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL query string * @param queryState query state information * @param options query options * @param result intercepted method's execution result */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result) { ConnectorImpl.queryProcessorWrapper() .process(queryString, queryState, options, startTime, result); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL statement string * @param keyspace query's keyspace * @param prepared prepared statement * @param forThrift is it a Thrift statement * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) String keyspace, @Advice.Argument(2) ParsedStatement.Prepared prepared, @Advice.Argument(3) boolean forThrift, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .storePrepared(queryString, keyspace, forThrift, prepared, preparedStatements); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param statement CQL statement to be executed * @param queryState query state information * @param options query options * @param result intercepted method's execution result * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) CQLStatement statement, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .processPrepared(statement, queryState, options, startTime, result, preparedStatements); } }
private Query createGenericQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(), Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options)); }
/** * Initialize connector instance using the provided instrumentation. * * @param inst Instrumentation reference * @param queryReporter QueryReporter implementation reference * @param configuration connector specific configuration * @param globalConfiguration global configuration general for diagnostics */ public void init(Instrumentation inst, QueryReporter queryReporter, ConnectorConfiguration configuration, GlobalConfiguration globalConfiguration) { ConnectorImpl.configuration = configuration; ConnectorImpl.globalConfiguration = globalConfiguration; queryProcessorWrapper = new QueryProcessorWrapper(queryReporter, configuration); setQueryProcessorIntercepter(inst); setCassandraDaemonIntercepter(inst); }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL query string * @param queryState query state information * @param options query options * @param result intercepted method's execution result */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result) { ConnectorImpl.queryProcessorWrapper() .process(queryString, queryState, options, startTime, result); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL statement string * @param keyspace query's keyspace * @param prepared prepared statement * @param forThrift is it a Thrift statement * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) String keyspace, @Advice.Argument(2) ParsedStatement.Prepared prepared, @Advice.Argument(3) boolean forThrift, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .storePrepared(queryString, keyspace, forThrift, prepared, preparedStatements); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param statement CQL statement to be executed * @param queryState query state information * @param options query options * @param result intercepted method's execution result * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) CQLStatement statement, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .processPrepared(statement, queryState, options, startTime, result, preparedStatements); } }
private Query createQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { Query query; if (statement instanceof SelectStatement) { query = createQuery(startTime, execTime, queryString, (SelectStatement) statement, queryState, options); } else if (statement instanceof ModificationStatement) { query = createQuery(startTime, execTime, queryString, (ModificationStatement) statement, queryState, options); } else { query = createGenericQuery(startTime, execTime, queryString, statement, queryState, options); } return query; }
private Query createGenericQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(), Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options)); }
/** * Wrapper for * {@link org.apache.cassandra.cql3.QueryProcessor#process(String, QueryState, QueryOptions)} method. * This method is invoked after the original method, measures the execution time and reports query. * * @param queryString QueryProcessor#process(String, QueryState, QueryOptions) * @param queryState QueryProcessor#process(String, QueryState, QueryOptions) * @param options QueryProcessor#process(String, QueryState, QueryOptions) * @param startTime query execution start time * @param result statement execution result */ public void process(String queryString, QueryState queryState, QueryOptions options, long startTime, ResultMessage result) { final long execTime = System.currentTimeMillis() - startTime; report(startTime, execTime, queryString, null, queryState, options, null); }
/** * Initialize connector instance using the provided instrumentation. * * @param inst Instrumentation reference * @param queryReporter QueryReporter implementation reference * @param configuration connector specific configuration * @param globalConfiguration global configuration general for diagnostics */ public void init(Instrumentation inst, QueryReporter queryReporter, ConnectorConfiguration configuration, GlobalConfiguration globalConfiguration) { ConnectorImpl.configuration = configuration; ConnectorImpl.globalConfiguration = globalConfiguration; queryProcessorWrapper = new QueryProcessorWrapper(queryReporter, configuration); setQueryProcessorIntercepter(inst); setCassandraDaemonIntercepter(inst); }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL query string * @param queryState query state information * @param options query options * @param result intercepted method's execution result */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result) { ConnectorImpl.queryProcessorWrapper() .process(queryString, queryState, options, startTime, result); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param queryString CQL statement string * @param keyspace query's keyspace * @param prepared prepared statement * @param forThrift is it a Thrift statement * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) String queryString, @Advice.Argument(1) String keyspace, @Advice.Argument(2) ParsedStatement.Prepared prepared, @Advice.Argument(3) boolean forThrift, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .storePrepared(queryString, keyspace, forThrift, prepared, preparedStatements); } }
/** * Code executed after the intercepted method. * * @param startTime execution start time recorded by the enter method. * @param statement CQL statement to be executed * @param queryState query state information * @param options query options * @param result intercepted method's execution result * @param preparedStatements QueryProcessor's internal list of prepared statements */ @Advice.OnMethodExit public static void exit(@Advice.Enter long startTime, @Advice.Argument(0) CQLStatement statement, @Advice.Argument(1) QueryState queryState, @Advice.Argument(2) QueryOptions options, @Advice.Return ResultMessage result, @Advice.FieldValue(value = "preparedStatements") ConcurrentLinkedHashMap<MD5Digest, ParsedStatement.Prepared> preparedStatements) { ConnectorImpl.queryProcessorWrapper() .processPrepared(statement, queryState, options, startTime, result, preparedStatements); } }
private Query createQuery(final long startTime, final long execTime, final String queryString, final CQLStatement statement, final QueryState queryState, final QueryOptions options) { Query query; if (statement instanceof SelectStatement) { query = createQuery(startTime, execTime, queryString, (SelectStatement) statement, queryState, options); } else if (statement instanceof ModificationStatement) { query = createQuery(startTime, execTime, queryString, (ModificationStatement) statement, queryState, options); } else { query = createGenericQuery(startTime, execTime, queryString, statement, queryState, options); } return query; }