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

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

本文整理了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

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

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

/**
 * Returns a new instance of Query.
 *
 * @param startTimeInMilliseconds     query execution's start time, given as epoch timestamp in milliseconds
 * @param executionTimeInMilliseconds query execution time in milliseconds
 * @param clientAddress               query's client socket address
 * @param statementType               type of query's statement
 * @param keyspace                    query's key space
 * @param tableName                   query's table name
 * @param statement                   query's CQL statement
 * @param consistencyLevel            query's consistencyLevel
 * @return a new Query instance
 */
public static Query create(final long startTimeInMilliseconds, final long executionTimeInMilliseconds,
    final String clientAddress, final StatementType statementType, final String keyspace,
    final String tableName, final String statement, final ConsistencyLevel consistencyLevel) {
  return new Query(startTimeInMilliseconds, executionTimeInMilliseconds, clientAddress, statementType, keyspace,
      tableName, statement, consistencyLevel);
}

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

slowQueryCounts.get(query.statementType()).increment();
tags.put("host", globalConfiguration.hostname);
tags.put("systemName", globalConfiguration.systemName);
tags.put("statementType", query.statementType().toString());
fields.put("client", query.clientAddress());
fields.put("statement", query.statement());
fields.put("consistencyLevel", query.consistencyLevel().name());
    (double) query.executionTimeInMilliseconds(), query.startTimeInMilliseconds(),
    TimeUnit.MILLISECONDS, tags, fields);

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

@Override
public void process(Query query) {
  final String statementType = query.statementType().name();
  final String consistencyLevel = query.consistencyLevel().name();
  for (RequestRate requestRate : requestRates) {
    if (statementMatches(statementType, requestRate)
        && consistencyLevelMatches(consistencyLevel, requestRate)) {
      requestRate.increment();
    }
  }
}

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

private boolean tableForLogging(Query query) {
  logger.trace("Checking if table is in tables for logging.");
  if (slowQueryConfiguration.tablesForLogging().isEmpty()) {
    return true;
  }
  if (StringUtils.isBlank(query.fullTableName())) {
    logger.debug("Query does not have table name.");
    return false;
  }
  for (String tableForLogging : slowQueryConfiguration.tablesForLogging()) {
    if (tableForLogging.equals(query.fullTableName())) {
      logger.debug("Taable {} is eligible for logging.", query.fullTableName());
      return true;
    }
  }
  return false;
}

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

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

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

/**
 * Based on defined criteria decide if this query is eligible for reporting.
 * @param query Query candidate for report.
 * @return if this query is eligible for report.
 */
public boolean isForReporting(Query query) {
  if (executionTimeForLogging(query.executionTimeInMilliseconds()) && tableForLogging(query)
      && typeForLogging(query)) {
    return true;
  }
  return false;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章