com.addthis.hydra.data.query.Query.isTraced()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(203)

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

Query.isTraced介绍

暂无

代码示例

代码示例来源:origin: addthis/hydra

void checkForStragglersMeans() {
  int totalTasks = sourceAggregator.totalTasks;
  int numRemaining = totalTasks - sourceAggregator.completed;
  int tasksDoneCutoff = Math.max(1, (int) Math.ceil(AggregateConfig.stragglerCheckHostPercentage * totalTasks));
  long elapsedTime = JitterClock.globalTime() - sourceAggregator.startTime;
  double timeCutoff = AggregateConfig.stragglerCheckMeanRuntimeFactor * getMeanRuntime();
  if (numRemaining == 0) {
    if (MeshSourceAggregator.log.isDebugEnabled() || sourceAggregator.query.isTraced()) {
      Query.traceLog.info("Straggler checker for {} detected query done. Exiting.",
                sourceAggregator.query.uuid());
    }
  } else if ((numRemaining <= tasksDoneCutoff) && (elapsedTime > timeCutoff)) {
    handleStragglers();
  }
}

代码示例来源:origin: addthis/hydra

void checkForStragglersStdDev() {
  Query query = sourceAggregator.query;
  int totalTasks = sourceAggregator.totalTasks;
  int numRemaining = totalTasks - sourceAggregator.completed;
  int tasksDoneCutoff = Math.max(1, (int) Math.ceil(AggregateConfig.stragglerCheckHostPercentage * totalTasks));
  long elapsedTime = JitterClock.globalTime() - sourceAggregator.startTime;
  if (numRemaining == 0) {
    if (MeshSourceAggregator.log.isDebugEnabled() || query.isTraced()) {
      Query.traceLog.info("Straggler checker for {} detected query done. Exiting.", query.uuid());
    }
  } else if ((numRemaining <= tasksDoneCutoff) &&
        (elapsedTime > getStdDevsAwayRuntime(AggregateConfig.MULTIPLE_STD_DEVS))) {
    if (MeshSourceAggregator.log.isTraceEnabled()) {
      MeshSourceAggregator.log.trace("Running stragglers for query: {}", query.uuid());
      MeshSourceAggregator.log.trace(
          "numRemaining: {} taskDoneCutoff: {} deltaTime: {} {} stdDevsAway: {} Mean runtime: {}",
          numRemaining, tasksDoneCutoff, elapsedTime, AggregateConfig.MULTIPLE_STD_DEVS,
          getStdDevsAwayRuntime(AggregateConfig.MULTIPLE_STD_DEVS), getMeanRuntime());
    }
    handleStragglers();
  }
}

代码示例来源:origin: addthis/hydra

/**
   * Part 3 - SEARCH
   * Run the search -- most of this logic is in QueryEngine.search(). We only take care of logging times and
   * passing the sendComplete message along.
   */
  protected void search() {
    final long searchStartTime = System.currentTimeMillis();
    finalEng.search(query, queryOpProcessor, bridge.getQueryPromise());
    queryOpProcessor.sendComplete();
    final long searchDuration = System.currentTimeMillis() - searchStartTime;
    if (log.isDebugEnabled() || query.isTraced()) {
      Query.traceLog.info("[QueryReference] search complete {} in {}ms directory: {} slow={} rowsIn: {}",
                query.uuid(), searchDuration, goldDirString,
                searchDuration > MeshQuerySource.slowQueryThreshold, queryOpProcessor.getInputRows());
    }
    MeshQuerySource.queryTimes.update(searchDuration, TimeUnit.MILLISECONDS);
  }
}

代码示例来源:origin: addthis/hydra

/**
 * Part 2 - ENGINE CACHE
 * Get a QueryEngine for our query -- check the cache for a suitable candidate, otherwise make one.
 * Most of this logic is handled by the QueryEngineCache.get() function.
 */
protected QueryEngine getEngine() throws Exception {
  final long engineGetStartTime = System.currentTimeMillis();
  // Use the canonical path stored in the canonicalDirString to create a QueryEngine. By that way
  // if the alias changes new queries will use the latest available
  // database and the old engines will be automatically closed after their TTL expires.
  QueryEngine engine = MeshQuerySource.queryEngineCache.getAndLease(goldDirString);
  final long engineGetDuration = System.currentTimeMillis() - engineGetStartTime;
  MeshQuerySource.engineGetTimer.update(engineGetDuration, TimeUnit.MILLISECONDS);
  if (engine == null) //Cache returned null -- this doesn't mean cache miss. It means something went fairly wrong
  {
    log.warn("[QueryReference] Unable to retrieve queryEngine for query: {}, key: {} after waiting: {}ms",
        query.uuid(), goldDirString, engineGetDuration);
    throw new DataChannelError("Unable to retrieve queryEngine for query: " + query.uuid() +
                  ", key: " + goldDirString + " after waiting: " + engineGetDuration + "ms");
  } //else we got an engine so we're good -- maybe this logic should be in the cache get
  if ((engineGetDuration > MeshQuerySource.slowQueryThreshold) || log.isDebugEnabled() || query.isTraced()) {
    Query.traceLog.info(
        "[QueryReference] Retrieved queryEngine for query: {}, key:{} after waiting: {}ms.  slow={}",
        query.uuid(), goldDirString, engineGetDuration,
        engineGetDuration > MeshQuerySource.slowQueryThreshold);
  }
  return engine;
}

代码示例来源:origin: addthis/hydra

public void handleStragglers() {
    for (QueryTaskSource taskSource : sourceAggregator.taskSources) {
      if (taskSource.oneHasResponded() || (taskSource.options.length == 0)) {
        continue;
      }
      for (QueryTaskSourceOption option : taskSource.options) {
        if (!option.isActive()) {
          if (option.tryActivate(sourceAggregator.meshy, sourceAggregator.queryOptions)) {
            AggregateConfig.totalStragglerCheckerRequests.inc();
            if (MeshSourceAggregator.log.isDebugEnabled() || sourceAggregator.query.isTraced()) {
              Query.traceLog.info("Straggler detected for {} sending duplicate query to host: {}",
                        sourceAggregator.query.uuid(), option.queryReference.getHostUUID());
            }
            break;
          }
        }
      }
    }
  }
}

代码示例来源:origin: addthis/hydra

.put("query.hosts", query.getParameter("hosts"))
.put("query.ops", query.getOps())
.put("trace", query.isTraced())
.put("sources", query.getParameter("sources"))
.put("time", System.currentTimeMillis())

相关文章