void (long lookupFinishedAtMs) { Span lookupSpan = OTEL_TRACER.spanBuilder(SPAN_NAME_INDEX_LOOKUP_STUBS) .setAttribute("index_id", indexId.getName()) .setAttribute("total_keys_in_index", totalKeysIndexed) .setAttribute("lookup_result_size", lookupResultSize) .setStartTimestamp(lookupStartedAtMs, MILLISECONDS) .startSpan(); lookupSpan.setStatus(lookupFailed ? StatusCode.ERROR : StatusCode.OK); try (Scope scope = lookupSpan.makeCurrent()) { if (indexValidationFinishedAtMs > 0) { OTEL_TRACER.spanBuilder(SPAN_NAME_INDEX_UP_TO_DATE_CHECK) .setStartTimestamp(lookupStartedAtMs, MILLISECONDS) .startSpan() .end(indexValidationFinishedAtMs, MILLISECONDS); } if (stubTreesDeserializingStarted > 0) { OTEL_TRACER.spanBuilder(SPAN_NAME_STUB_TREE_DESERIALIZATION) .setStartTimestamp(stubTreesDeserializingStarted, MILLISECONDS) .startSpan() .end(lookupFinishedAtMs, MILLISECONDS); } } lookupSpan.end(lookupFinishedAtMs, MILLISECONDS); }