Interface AsyncOperationEndStrategy

All Known Implementing Classes:
Jdk8AsyncOperationEndStrategy

public interface AsyncOperationEndStrategy
Implementations of this interface describe how to compose over supported asynchronous computation types and delay marking the operation as ended by calling Instrumenter.end(Context, Object, Object, Throwable).
  • Method Summary

    Modifier and Type
    Method
    Description
    <REQUEST, RESPONSE>
    Object
    end(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<REQUEST,RESPONSE> instrumenter, io.opentelemetry.context.Context context, REQUEST request, Object asyncValue, Class<RESPONSE> responseType)
    Composes over asyncValue and delays the Instrumenter.end(Context, Object, Object, Throwable) call until after the asynchronous operation represented by asyncValue completes.
    boolean
    supports(Class<?> asyncType)
    Returns true for every asynchronous computation type asyncType this strategy supports.
  • Method Details

    • supports

      boolean supports(Class<?> asyncType)
      Returns true for every asynchronous computation type asyncType this strategy supports.
    • end

      <REQUEST, RESPONSE> Object end(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<REQUEST,RESPONSE> instrumenter, io.opentelemetry.context.Context context, REQUEST request, Object asyncValue, Class<RESPONSE> responseType)
      Composes over asyncValue and delays the Instrumenter.end(Context, Object, Object, Throwable) call until after the asynchronous operation represented by asyncValue completes.
      Parameters:
      instrumenter - The Instrumenter to be used to end the operation stored in the context.
      asyncValue - Return value from the instrumented method. Must be an instance of a asyncType for which supports(Class) returned true (in particular it must not be null).
      responseType - Expected type of the response that should be obtained from the asyncValue. If the result of the async computation is instance of the passed type it will be passed when the instrumenter is called.
      Returns:
      Either asyncValue or a value composing over asyncValue for notification of completion.