@InterfaceAudience.Private public final class ActiveAuditManagerS3A extends org.apache.hadoop.service.CompositeService implements AuditManagerS3A
OperationAuditor for auditing.
It then stores the thread-local span and returns a wrapping
span.
When the wrapper is closed/deactivated it
will deactivate the wrapped span and then
switch the active span to the unbounded span.
This class also implements ExecutionInterceptor and
returns itself in createExecutionInterceptors();
once registered with the S3 client, the implemented methods
will be called during different parts of an SDK request lifecycle,
which then locate the active span and forward the request.
If any such invocation raises an AuditFailureException
then the IOStatistics counter for AUDIT_FAILURE
is incremented.
Uses the WeakReferenceThreadMap to store spans for threads.
Provided a calling class retains a reference to the span,
the active span will be retained.| Modifier and Type | Field and Description |
|---|---|
static String |
AUDIT_MANAGER_OPERATION |
static String |
NOT_A_WRAPPED_SPAN |
static org.apache.hadoop.fs.store.LogExactlyOnce |
WARN_OF_SPAN_TYPE
One of logger for warnings about span retrieval.
|
| Constructor and Description |
|---|
ActiveAuditManagerS3A(org.apache.hadoop.fs.statistics.impl.IOStatisticsStore iostatistics)
Instantiate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterExecution(software.amazon.awssdk.core.interceptor.Context.AfterExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
Forward to active span.
|
void |
afterMarshalling(software.amazon.awssdk.core.interceptor.Context.AfterMarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
afterTransmission(software.amazon.awssdk.core.interceptor.Context.AfterTransmission context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
afterUnmarshalling(software.amazon.awssdk.core.interceptor.Context.AfterUnmarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
beforeExecution(software.amazon.awssdk.core.interceptor.Context.BeforeExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
Forward to the active span.
|
void |
beforeMarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeMarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
beforeTransmission(software.amazon.awssdk.core.interceptor.Context.BeforeTransmission context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
beforeUnmarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeUnmarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
boolean |
checkAccess(org.apache.hadoop.fs.Path path,
S3AFileStatus status,
org.apache.hadoop.fs.permission.FsAction mode)
Check for permission to access a path.
|
List<software.amazon.awssdk.core.interceptor.ExecutionInterceptor> |
createExecutionInterceptors()
Return a list of execution interceptors for the AWS SDK which
relays to this class.
|
AuditSpanS3A |
createSpan(String operation,
String path1,
String path2)
Start an operation; as well as invoking the audit
service to do this, sets the operation as the
active operation for this thread.
|
software.amazon.awssdk.transfer.s3.progress.TransferListener |
createTransferListener()
Return a transfer callback which
fixes the active span context to be that in which
the transfer listener was created.
|
AuditSpanS3A |
getActiveAuditSpan()
Return the active wrapped span.
|
OperationAuditor |
getAuditor()
Get the auditor; valid once initialized.
|
String |
getOperationName()
Get the name of the operation.
|
String |
getSpanId()
The Span ID in the audit manager is the ID of the auditor,
which can be used in the filesystem toString() method
to assist in correlating client logs with S3 logs.
|
software.amazon.awssdk.http.SdkHttpRequest |
modifyHttpRequest(software.amazon.awssdk.core.interceptor.Context.ModifyHttpRequest context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
software.amazon.awssdk.http.SdkHttpResponse |
modifyHttpResponse(software.amazon.awssdk.core.interceptor.Context.ModifyHttpResponse context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
software.amazon.awssdk.core.SdkRequest |
modifyRequest(software.amazon.awssdk.core.interceptor.Context.ModifyRequest context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
software.amazon.awssdk.core.SdkResponse |
modifyResponse(software.amazon.awssdk.core.interceptor.Context.ModifyResponse context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) |
void |
onExecutionFailure(software.amazon.awssdk.core.interceptor.Context.FailedExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
Forward to active span.
|
void |
requestCreated(software.amazon.awssdk.core.SdkRequest.Builder builder)
Audit the creation of a request and retrieve
a reference to the active thread span.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf) |
protected void |
serviceStart()
After starting the auditor, it is queried for its
unbonded span, which is then wrapped and stored for
use.
|
protected void |
serviceStop() |
String |
toString() |
addIfService, addService, getServices, removeServiceclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static final org.apache.hadoop.fs.store.LogExactlyOnce WARN_OF_SPAN_TYPE
public static final String AUDIT_MANAGER_OPERATION
public static final String NOT_A_WRAPPED_SPAN
public ActiveAuditManagerS3A(org.apache.hadoop.fs.statistics.impl.IOStatisticsStore iostatistics)
iostatistics - statistics targetprotected void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws Exception
serviceInit in class org.apache.hadoop.service.CompositeServiceExceptionprotected void serviceStart()
throws Exception
serviceStart in class org.apache.hadoop.service.CompositeServiceExceptionprotected void serviceStop()
throws Exception
serviceStop in class org.apache.hadoop.service.CompositeServiceExceptionpublic String toString()
toString in class org.apache.hadoop.service.AbstractServicepublic OperationAuditor getAuditor()
AuditManagerS3AgetAuditor in interface AuditManagerS3Apublic AuditSpanS3A getActiveAuditSpan()
getActiveAuditSpan in interface org.apache.hadoop.fs.store.audit.ActiveThreadSpanSource<AuditSpanS3A>public String getSpanId()
AWSAuditEventCallbacks.getSpanId in interface AWSAuditEventCallbackspublic String getOperationName()
AWSAuditEventCallbacksgetOperationName in interface AWSAuditEventCallbackspublic AuditSpanS3A createSpan(String operation, @Nullable String path1, @Nullable String path2) throws IOException
createSpan in interface org.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A>operation - operation name.path1 - first path of operationpath2 - second path of operationIOException - failurepublic List<software.amazon.awssdk.core.interceptor.ExecutionInterceptor> createExecutionInterceptors() throws IOException
createExecutionInterceptors in interface AuditManagerS3AIOException - failure.public software.amazon.awssdk.transfer.s3.progress.TransferListener createTransferListener()
AuditManagerS3AcreateTransferListener in interface AuditManagerS3Apublic boolean checkAccess(org.apache.hadoop.fs.Path path,
S3AFileStatus status,
org.apache.hadoop.fs.permission.FsAction mode)
throws IOException
AuditManagerS3AFileSystem.access() command
and is a soft permission check used by Hive.checkAccess in interface AuditManagerS3Apath - path to checkstatus - status of the path.mode - access mode.IOException - failurepublic void requestCreated(software.amazon.awssdk.core.SdkRequest.Builder builder)
requestCreated in interface AWSAuditEventCallbacksbuilder - the request builder.public void beforeExecution(software.amazon.awssdk.core.interceptor.Context.BeforeExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
Statistic.AUDIT_REQUEST_EXECUTION;
failures will also increment
Statistic.AUDIT_FAILURE;
beforeExecution in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void afterExecution(software.amazon.awssdk.core.interceptor.Context.AfterExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
afterExecution in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void onExecutionFailure(software.amazon.awssdk.core.interceptor.Context.FailedExecution context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
onExecutionFailure in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorcontext - execution contextexecutionAttributes - the execution attributes
public software.amazon.awssdk.core.SdkRequest modifyRequest(software.amazon.awssdk.core.interceptor.Context.ModifyRequest context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
modifyRequest in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void beforeMarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeMarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
beforeMarshalling in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void afterMarshalling(software.amazon.awssdk.core.interceptor.Context.AfterMarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
afterMarshalling in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic software.amazon.awssdk.http.SdkHttpRequest modifyHttpRequest(software.amazon.awssdk.core.interceptor.Context.ModifyHttpRequest context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
modifyHttpRequest in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void beforeTransmission(software.amazon.awssdk.core.interceptor.Context.BeforeTransmission context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
beforeTransmission in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void afterTransmission(software.amazon.awssdk.core.interceptor.Context.AfterTransmission context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
afterTransmission in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic software.amazon.awssdk.http.SdkHttpResponse modifyHttpResponse(software.amazon.awssdk.core.interceptor.Context.ModifyHttpResponse context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
modifyHttpResponse in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void beforeUnmarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeUnmarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
beforeUnmarshalling in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic void afterUnmarshalling(software.amazon.awssdk.core.interceptor.Context.AfterUnmarshalling context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
afterUnmarshalling in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorpublic software.amazon.awssdk.core.SdkResponse modifyResponse(software.amazon.awssdk.core.interceptor.Context.ModifyResponse context,
software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes)
modifyResponse in interface software.amazon.awssdk.core.interceptor.ExecutionInterceptorCopyright © 2008–2024 Apache Software Foundation. All rights reserved.