Class JaxRsServerAsyncTestEndpoint

java.lang.Object
org.eclipse.microprofile.telemetry.tracing.tck.async.JaxRsServerAsyncTestEndpoint

@Path("JaxRsServerAsyncTestEndpoint") public class JaxRsServerAsyncTestEndpoint extends Object
This endpoint is used to test MP Telemetry integration with async JAX-RS resource methods.

It does the following:

  • Creates a span
  • Reads the baggage entry with key BAGGAGE_KEY and if present sets span attribute BAGGAGE_VALUE_ATTR to the entry value
  • Submits a subtask to a managed executor with the context propagated and returns a CompletableFuture representing the result of the subtask
  • In the subtask it:
    • Creates a span
    • Sleeps three seconds (to ensure that there is no chance of the subtask completing before the resource method returns)
    • Reads the baggage entry with key BAGGAGE_KEY and if present sets span attribute BAGGAGE_VALUE_ATTR to the entry value
    • Returns "OK"
  • Field Details

    • BAGGAGE_KEY

      public static final String BAGGAGE_KEY
      See Also:
    • BAGGAGE_VALUE_ATTR

      public static final io.opentelemetry.api.common.AttributeKey<String> BAGGAGE_VALUE_ATTR
  • Constructor Details

    • JaxRsServerAsyncTestEndpoint

      public JaxRsServerAsyncTestEndpoint()
  • Method Details

    • getCompletionStage

      @GET @Path("completionstage") public CompletionStage<String> getCompletionStage(@QueryParam("baggageValue") String queryValue)
    • getCompletionStageError

      @GET @Path("completionstageerror") public CompletionStage<jakarta.ws.rs.core.Response> getCompletionStageError(@QueryParam("baggageValue") String queryValue)
    • getSuspend

      @GET @Path("suspend") public void getSuspend(@Suspended jakarta.ws.rs.container.AsyncResponse async, @QueryParam("baggageValue") String queryValue)
    • getSuspendError

      @GET @Path("suspenderror") public void getSuspendError(@Suspended jakarta.ws.rs.container.AsyncResponse async, @QueryParam("baggageValue") String queryValue)