Class TraceIdExecutionInterceptor

java.lang.Object
software.amazon.awssdk.awscore.interceptor.TraceIdExecutionInterceptor
All Implemented Interfaces:
ExecutionInterceptor

public class TraceIdExecutionInterceptor extends Object implements ExecutionInterceptor
The TraceIdExecutionInterceptor copies the trace details to the TRACE_ID_HEADER header, assuming we seem to be running in a lambda environment.
  • Constructor Details

    • TraceIdExecutionInterceptor

      public TraceIdExecutionInterceptor()
  • Method Details

    • beforeExecution

      public void beforeExecution(Context.BeforeExecution context, ExecutionAttributes executionAttributes)
      Description copied from interface: ExecutionInterceptor
      Read a request that has been given to a service client before it is modified by other interceptors. ExecutionInterceptor.beforeMarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeMarshalling, software.amazon.awssdk.core.interceptor.ExecutionAttributes) should be used in most circumstances for reading the request because it includes modifications made by other interceptors.

      This method is guaranteed to be executed on the thread that is making the client call. This is true even if a non- blocking I/O client is used. This is useful for transferring data that may be stored thread-locally into the execution's ExecutionAttributes.

      Specified by:
      beforeExecution in interface ExecutionInterceptor
      Parameters:
      context - The current state of the execution, including the unmodified SDK request from the service client call.
      executionAttributes - A mutable set of attributes scoped to one specific request/response cycle that can be used to
    • modifyHttpRequest

      public SdkHttpRequest modifyHttpRequest(Context.ModifyHttpRequest context, ExecutionAttributes executionAttributes)
      Description copied from interface: ExecutionInterceptor
      Modify the SdkHttpFullRequest before it is sent to the service.
      Specified by:
      modifyHttpRequest in interface ExecutionInterceptor
      Parameters:
      context - The current state of the execution, including the SDK and current HTTP request.
      executionAttributes - A mutable set of attributes scoped to one specific request/response cycle that can be used to give data to future lifecycle methods.
      Returns:
      The potentially-modified HTTP request that should be sent to the service. Must not be null.
    • afterExecution

      public void afterExecution(Context.AfterExecution context, ExecutionAttributes executionAttributes)
      Description copied from interface: ExecutionInterceptor
      Read the finalized SdkResponse as it will be returned by the client invocation.
      Specified by:
      afterExecution in interface ExecutionInterceptor
      Parameters:
      context - The current state of the execution, including the SDK and HTTP requests as well as the SDK and HTTP response.
      executionAttributes - A mutable set of attributes scoped to one specific request/response cycle that can be used to give data to future lifecycle methods.
    • onExecutionFailure

      public void onExecutionFailure(Context.FailedExecution context, ExecutionAttributes executionAttributes)
      Description copied from interface: ExecutionInterceptor
      Invoked when any error happens during an execution that prevents the request from succeeding. This could be due to an error returned by a service call, a request timeout or even another interceptor raising an exception. The provided exception will be thrown by the service client.

      This will only be invoked if the entire execution fails. If a retriable error happens (according to the RetryPolicy) and a subsequent retry succeeds, this method will not be invoked.

      Specified by:
      onExecutionFailure in interface ExecutionInterceptor
      Parameters:
      context - The context associated with the execution that failed. An SDK request will always be available, but depending on the time at which the failure happened, the HTTP request, HTTP response and SDK response may not be available. This also includes the exception that triggered the failure.
      executionAttributes - A mutable set of attributes scoped to one specific request/response cycle that can be used to give data to future lifecycle methods.