Class AsyncOperationEndSupport<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.annotation.support.async.AsyncOperationEndSupport<REQUEST,RESPONSE>
-
public final class AsyncOperationEndSupport<REQUEST,RESPONSE> extends Object
A wrapper overInstrumenterthat is able to deferInstrumenter.end(Context, Object, Object, Throwable)until asynchronous computation finishes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <ASYNC> @Nullable ASYNCasyncEnd(io.opentelemetry.context.Context context, REQUEST request, @Nullable ASYNC asyncValue, @Nullable Throwable throwable)Attempts to compose over passedasyncValueand delay theInstrumenter.end(Context, Object, Object, Throwable)call until the async operation completes.static <REQUEST,RESPONSE>
AsyncOperationEndSupport<REQUEST,RESPONSE>create(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<REQUEST,RESPONSE> syncInstrumenter, Class<RESPONSE> responseType, Class<?> asyncType)Returns a newAsyncOperationEndSupportthat wraps over passedsyncInstrumenter, configured for usage with asynchronous computations that are instances ofasyncType.static <RESPONSE> @Nullable RESPONSEtryToGetResponse(Class<RESPONSE> responseType, @Nullable Object asyncValue)
-
-
-
Method Detail
-
create
public static <REQUEST,RESPONSE> AsyncOperationEndSupport<REQUEST,RESPONSE> create(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<REQUEST,RESPONSE> syncInstrumenter, Class<RESPONSE> responseType, Class<?> asyncType)
Returns a newAsyncOperationEndSupportthat wraps over passedsyncInstrumenter, configured for usage with asynchronous computations that are instances ofasyncType. If the result of the async computation ends up being an instance ofresponseTypeit will be passed as the response to thesyncInstrumentercall; otherwisenullvalue will be used as the response.
-
asyncEnd
public <ASYNC> @Nullable ASYNC asyncEnd(io.opentelemetry.context.Context context, REQUEST request, @Nullable ASYNC asyncValue, @Nullable Throwable throwable)Attempts to compose over passedasyncValueand delay theInstrumenter.end(Context, Object, Object, Throwable)call until the async operation completes.This method will end the operation immediately if
throwableis passed, if there is noAsyncOperationEndStrategyfor theasyncTypeused, or if there is a type mismatch between passedasyncValueand theasyncTypethat was used to create this object.If the passed
asyncValueis recognized as an asynchronous computation, the operation won't beendeduntilasyncValuecompletes.
-
-