@Test
  public void traceAsyncAdminEndpoint() throws Exception {
    final AsyncConnection connection = connectionRule.getAsyncConnection();
    final AsyncAdmin admin = connection.getAdmin();
    final EchoRequestProto request = EchoRequestProto.newBuilder().setMessage("hello").build();
    final ServiceCaller<TestProtobufRpcProto, EchoResponseProto> callback =
      (stub, controller, cb) -> stub.echo(controller, request, cb);

    final String response = TraceUtil
      .tracedFuture(() -> admin.coprocessorService(TestProtobufRpcProto::newStub, callback),
        testName.getMethodName())
      .get().getMessage();
    assertEquals("hello", response);

    final Matcher<SpanData> parentMatcher = allOf(hasName(testName.getMethodName()), hasEnded());
    waitForAndLog(parentMatcher);
    final List<SpanData> spans = otelClassRule.getSpans();

    final SpanData testSpan =
      spans.stream().filter(parentMatcher::matches).findFirst().orElseThrow(AssertionError::new);
    final Matcher<SpanData> rpcMatcher = allOf(hasName("hbase.pb.MasterService/ExecMasterService"),
      hasParentSpanId(testSpan), hasStatusWithCode(StatusCode.OK));
    assertThat(spans, hasItem(rpcMatcher));
  }
Test cases to verify tracing coprocessor Endpoint execution
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpointTracing.java