Class TraceIdExecutionInterceptor
java.lang.Object
software.amazon.awssdk.awscore.interceptor.TraceIdExecutionInterceptor
- All Implemented Interfaces:
ExecutionInterceptor
@SdkProtectedApi
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterExecution(Context.AfterExecution context, ExecutionAttributes executionAttributes) Read the finalizedSdkResponseas it will be returned by the client invocation.voidbeforeExecution(Context.BeforeExecution context, ExecutionAttributes executionAttributes) Read a request that has been given to a service client before it is modified by other interceptors.modifyHttpRequest(Context.ModifyHttpRequest context, ExecutionAttributes executionAttributes) Modify theSdkHttpFullRequestbefore it is sent to the service.voidonExecutionFailure(Context.FailedExecution context, ExecutionAttributes executionAttributes) Invoked when any error happens during an execution that prevents the request from succeeding.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.awssdk.core.interceptor.ExecutionInterceptor
afterMarshalling, afterTransmission, afterUnmarshalling, beforeMarshalling, beforeTransmission, beforeUnmarshalling, modifyAsyncHttpContent, modifyAsyncHttpResponseContent, modifyException, modifyHttpContent, modifyHttpResponse, modifyHttpResponseContent, modifyRequest, modifyResponse
-
Constructor Details
-
TraceIdExecutionInterceptor
public TraceIdExecutionInterceptor()
-
-
Method Details
-
beforeExecution
public void beforeExecution(Context.BeforeExecution context, ExecutionAttributes executionAttributes) Description copied from interface:ExecutionInterceptorRead 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:
beforeExecutionin interfaceExecutionInterceptor- 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:ExecutionInterceptorModify theSdkHttpFullRequestbefore it is sent to the service.- Specified by:
modifyHttpRequestin interfaceExecutionInterceptor- 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
Description copied from interface:ExecutionInterceptorRead the finalizedSdkResponseas it will be returned by the client invocation.- Specified by:
afterExecutionin interfaceExecutionInterceptor- 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:ExecutionInterceptorInvoked 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:
onExecutionFailurein interfaceExecutionInterceptor- 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.
-