@Test
  public void traceSyncTableRegionCoprocessorRpcChannel() throws Exception {
    final Connection connection = connectionRule.getConnection();
    try (final Table table = connection.getTable(TEST_TABLE)) {
      final EchoRequestProto request = EchoRequestProto.newBuilder().setMessage("hello").build();
      final EchoResponseProto response = TraceUtil.trace(() -> {
        try {
          final CoprocessorRpcChannel channel = table.coprocessorService(new byte[] {});
          final TestProtobufRpcProto.BlockingInterface service =
            TestProtobufRpcProto.newBlockingStub(channel);
          return service.echo(null, request);
        } catch (Throwable t) {
          throw new RuntimeException(t);
        }
      }, testName.getMethodName());
      assertNotNull(response);
      assertEquals("hello", response.getMessage());
    }

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

    /*
     * This interface is really low level: it returns a Channel and expects the caller to invoke it.
     * The Table instance isn't issuing a command here, it's not a table operation, so don't expect
     * there to be a span like `COPROC_EXEC table`.
     */
    final SpanData testSpan =
      spans.stream().filter(parentMatcher::matches).findFirst().orElseThrow(AssertionError::new);
    final Matcher<SpanData> tableOpMatcher =
      allOf(hasName(containsString("COPROC_EXEC")), hasParentSpanId(testSpan));
    assertThat(spans, not(hasItem(tableOpMatcher)));
  }
Test cases to verify tracing coprocessor Endpoint execution
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpointTracing.java