public QueryObserver startTrace() {
    QueryObserver queryObserver = null;
    if (traceOn && cache != null) {

      QueryObserver qo = QueryObserverHolder.getInstance();
      if (qo instanceof IndexTrackingQueryObserver) {
        queryObserver = qo;
      } else if (!QueryObserverHolder.hasObserver()) {
        queryObserver = new IndexTrackingQueryObserver();
        QueryObserverHolder.setInstance(queryObserver);
      } else {
        queryObserver = qo;
      }
      logger.info("Starting query: " + queryString);
    }
    return queryObserver;
  }
For queries which are executed from a Function "with a Filter".

@return returns if this query is coming from a {@link Function}.
geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java