void () { if (!mustBeStarted()) { //if trace wasn't started -> nothing (meaningful) to report return; } try { requireNonNull(indexId, "indexId must be set here"); final long lookupFinishedAtMs = System.currentTimeMillis(); final long lookupDurationMs = lookupFinishedAtMs - lookupStartedAtMs; if (REPORT_INDIVIDUAL_LOOKUPS_TO_FUS) { if (lookupDurationMs > REPORT_TO_FUS_INDIVIDUAL_LOOKUPS_ONLY_LONGER_THAN_MS || lookupFailed) { reportDetailedDataToFUS(lookupFinishedAtMs); } } if (REPORT_INDIVIDUAL_LOOKUPS_TO_OPEN_TELEMETRY) { reportDetailedDataToOTel(lookupFinishedAtMs); } if (COLLECT_AGGREGATED_STATS) { collectAggregatedData(lookupFinishedAtMs); } } finally { //indexId = null; //intentionally not clear it to provide a bit more debugging info project = null;//avoid keeping reference to project in a thread-locals if (parentTrace != null) { currentTraceHolder.set(parentTrace); } else { depth = -1;//since we re-use root trace object, we need to put it back to un-initialized state //or how we will know it is ready-to-use next time? } } }