io.smartcat.cassandra.diagnostics.Query类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(264)

本文整理了Java中io.smartcat.cassandra.diagnostics.Query类的一些代码示例,展示了Query类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query类的具体详情如下:
包路径:io.smartcat.cassandra.diagnostics.Query
类名称:Query

Query介绍

[英]This class represents a query report.
[中]此类表示一个查询报告。

代码示例

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createGenericQuery(final long startTime, final long execTime, final String queryString,
  2. final CQLStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options));
  5. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-commons

  1. /**
  2. * Returns a new instance of Query.
  3. *
  4. * @param startTimeInMilliseconds query execution's start time, given as epoch timestamp in milliseconds
  5. * @param executionTimeInMilliseconds query execution time in milliseconds
  6. * @param clientAddress query's client socket address
  7. * @param statementType type of query's statement
  8. * @param keyspace query's key space
  9. * @param tableName query's table name
  10. * @param statement query's CQL statement
  11. * @param consistencyLevel query's consistencyLevel
  12. * @return a new Query instance
  13. */
  14. public static Query create(final long startTimeInMilliseconds, final long executionTimeInMilliseconds,
  15. final String clientAddress, final StatementType statementType, final String keyspace,
  16. final String tableName, final String statement, final ConsistencyLevel consistencyLevel) {
  17. return new Query(startTimeInMilliseconds, executionTimeInMilliseconds, clientAddress, statementType, keyspace,
  18. tableName, statement, consistencyLevel);
  19. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-core

  1. slowQueryCounts.get(query.statementType()).increment();
  2. tags.put("host", globalConfiguration.hostname);
  3. tags.put("systemName", globalConfiguration.systemName);
  4. tags.put("statementType", query.statementType().toString());
  5. fields.put("client", query.clientAddress());
  6. fields.put("statement", query.statement());
  7. fields.put("consistencyLevel", query.consistencyLevel().name());
  8. (double) query.executionTimeInMilliseconds(), query.startTimeInMilliseconds(),
  9. TimeUnit.MILLISECONDS, tags, fields);

代码示例来源:origin: io.smartcat/cassandra-diagnostics-core

  1. @Override
  2. public void process(Query query) {
  3. final String statementType = query.statementType().name();
  4. final String consistencyLevel = query.consistencyLevel().name();
  5. for (RequestRate requestRate : requestRates) {
  6. if (statementMatches(statementType, requestRate)
  7. && consistencyLevelMatches(consistencyLevel, requestRate)) {
  8. requestRate.increment();
  9. }
  10. }
  11. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-core

  1. private boolean tableForLogging(Query query) {
  2. logger.trace("Checking if table is in tables for logging.");
  3. if (slowQueryConfiguration.tablesForLogging().isEmpty()) {
  4. return true;
  5. }
  6. if (StringUtils.isBlank(query.fullTableName())) {
  7. logger.debug("Query does not have table name.");
  8. return false;
  9. }
  10. for (String tableForLogging : slowQueryConfiguration.tablesForLogging()) {
  11. if (tableForLogging.equals(query.fullTableName())) {
  12. logger.debug("Taable {} is eligible for logging.", query.fullTableName());
  13. return true;
  14. }
  15. }
  16. return false;
  17. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-core

  1. private boolean typeForLogging(Query query) {
  2. logger.trace("Checking if query type is for logging.");
  3. boolean logAll = slowQueryConfiguration.queryTypesToLog().contains("ALL");
  4. boolean queryTypeMatches = slowQueryConfiguration.queryTypesToLog().contains(query.statementType().toString());
  5. return logAll || queryTypeMatches;
  6. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-core

  1. /**
  2. * Based on defined criteria decide if this query is eligible for reporting.
  3. * @param query Query candidate for report.
  4. * @return if this query is eligible for report.
  5. */
  6. public boolean isForReporting(Query query) {
  7. if (executionTimeForLogging(query.executionTimeInMilliseconds()) && tableForLogging(query)
  8. && typeForLogging(query)) {
  9. return true;
  10. }
  11. return false;
  12. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createGenericQuery(final long startTime, final long execTime, final String queryString,
  2. final CQLStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options));
  5. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector30

  1. private Query createGenericQuery(final long startTime, final long execTime, final String queryString,
  2. final CQLStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options));
  5. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector21

  1. private Query createGenericQuery(final long startTime, final long execTime, final String queryString,
  2. final CQLStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UNKNOWN, "", "", queryString, extractConsistencyLevel(options));
  5. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final SelectStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.SELECT, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector21

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final SelectStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.SELECT, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector21

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final ModificationStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UPDATE, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector30

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final SelectStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.SELECT, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: io.smartcat/cassandra-diagnostics-connector30

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final ModificationStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UPDATE, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final SelectStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.SELECT, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final ModificationStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UPDATE, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query createQuery(final long startTime, final long execTime, final String queryString,
  2. final ModificationStatement statement, final QueryState queryState, final QueryOptions options) {
  3. return Query.create(startTime, execTime, queryState.getClientState().getRemoteAddress().toString(),
  4. Query.StatementType.UPDATE, statement.keyspace(), statement.columnFamily(), queryString,
  5. extractConsistencyLevel(options));
  6. }

代码示例来源:origin: smartcat-labs/cassandra-diagnostics

  1. private Query extractQuery(final long startTime, final long execTime, final Statement statement) {
  2. final String queryString = statementQueryString(statement);
  3. final Query.StatementType queryType = queryType(queryString);
  4. return Query.create(startTime, execTime, host, queryType, statement.getKeyspace(), "", queryString,
  5. extractConsistencyLevel(statement));
  6. }

相关文章

Query类方法