Class TraceIdExecutionInterceptor
java.lang.Object
software.amazon.awssdk.awscore.interceptor.TraceIdExecutionInterceptor
- All Implemented Interfaces:
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 TypeMethodDescriptionvoid
afterExecution
(Context.AfterExecution context, ExecutionAttributes executionAttributes) Read the finalizedSdkResponse
as it will be returned by the client invocation.void
beforeExecution
(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 theSdkHttpFullRequest
before it is sent to the service.void
onExecutionFailure
(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, wait
Methods 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: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 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:ExecutionInterceptor
Modify theSdkHttpFullRequest
before it is sent to the service.- Specified by:
modifyHttpRequest
in 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:ExecutionInterceptor
Read the finalizedSdkResponse
as it will be returned by the client invocation.- Specified by:
afterExecution
in 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: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 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.
-