void (long lookupFinishedAtMs) { Span lookupSpan = OTEL_TRACER.spanBuilder(SPAN_NAME_INDEX_LOOKUP_ALL_KEYS) .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()) { OTEL_TRACER.spanBuilder(SPAN_NAME_INDEX_UP_TO_DATE_CHECK) .setStartTimestamp(lookupStartedAtMs, MILLISECONDS) .startSpan() .end(indexValidationFinishedAtMs, MILLISECONDS); } lookupSpan.end(lookupFinishedAtMs, MILLISECONDS); }