private void findHotSpots()

in spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/QueryIndex.java [666:716]


  private void findHotSpots(
      int threshold,
      Deque<String> path,
      BiConsumer<List<String>, List<Query.KeyQuery>> consumer
  ) {
    final String keyRef = key;
    if (keyRef != null) {
      path.addLast("K=" + keyRef);

      equalChecks.forEach((v, idx) -> {
        path.addLast(keyRef + "," + v + ",:eq");
        idx.findHotSpots(threshold, path, consumer);
        path.removeLast();
      });

      path.addLast("other-checks");
      if (otherChecks.size() > threshold) {
        List<Query.KeyQuery> queries = new ArrayList<>(otherChecks.keySet());
        consumer.accept(new ArrayList<>(path), queries);
      }
      otherChecks.forEach((q, idx) -> {
        path.addLast(q.toString());
        idx.findHotSpots(threshold, path, consumer);
        path.removeLast();
      });
      path.removeLast();

      final QueryIndex<T> hasKeyIdxRef = hasKeyIdx;
      if (hasKeyIdxRef != null) {
        path.addLast("has");
        hasKeyIdxRef.findHotSpots(threshold, path, consumer);
        path.removeLast();
      }

      path.removeLast();
    }

    final QueryIndex<T> otherKeysIdxRef = otherKeysIdx;
    if (otherKeysIdxRef != null) {
      path.addLast("other-keys");
      otherKeysIdxRef.findHotSpots(threshold, path, consumer);
      path.removeLast();
    }

    final QueryIndex<T> missingKeysIdxRef = missingKeysIdx;
    if (missingKeysIdxRef != null) {
      path.addLast("missing-keys");
      missingKeysIdxRef.findHotSpots(threshold, path, consumer);
      path.removeLast();
    }
  }