@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.
The inner class AWSAuditEventCallbacks is returned
as a request handler in createRequestHandlers();
this forwards all requests to the outer ActiveAuditManagerS3A,
which then locates the active span and forwards the request.
If any such invocation raises an AuditFailureException
then the IOStatistics counter for AUDIT_FAILURE
is incremented.| 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 |
afterAttempt(com.amazonaws.handlers.HandlerAfterAttemptContext context)
After any attempt is made.
|
void |
afterError(com.amazonaws.Request<?> request,
com.amazonaws.Response<?> response,
Exception exception)
Forward to active span.
|
void |
afterResponse(com.amazonaws.Request<?> request,
com.amazonaws.Response<?> response)
Forward to active span.
|
void |
beforeAttempt(com.amazonaws.handlers.HandlerBeforeAttemptContext context)
Before any attempt is made.
|
<T extends com.amazonaws.AmazonWebServiceRequest> |
beforeExecution(T request)
Forward to the active span.
|
com.amazonaws.AmazonWebServiceRequest |
beforeMarshalling(com.amazonaws.AmazonWebServiceRequest request)
Request before marshalling.
|
void |
beforeRequest(com.amazonaws.Request<?> request)
Request before marshalling.
|
com.amazonaws.http.HttpResponse |
beforeUnmarshalling(com.amazonaws.Request<?> request,
com.amazonaws.http.HttpResponse httpResponse)
Before unmarshalling the response.
|
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<com.amazonaws.handlers.RequestHandler2> |
createRequestHandlers()
Return a request handler 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.
|
com.amazonaws.services.s3.transfer.internal.TransferStateChangeListener |
createStateChangeListener()
Return a transfer state change callback which
fixes the active span context to be that in which
the state change 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.
|
<T extends com.amazonaws.AmazonWebServiceRequest> |
requestCreated(T request)
Attach a reference to the active thread span, then
invoke the same callback on that active thread.
|
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.
|
String |
toString() |
addIfService, addService, getServices, removeService, serviceStopclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStoppublic 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.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<com.amazonaws.handlers.RequestHandler2> createRequestHandlers() throws IOException
createRequestHandlers in interface AuditManagerS3AIOException - failure.public com.amazonaws.services.s3.transfer.internal.TransferStateChangeListener createStateChangeListener()
AuditManagerS3AcreateStateChangeListener 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 <T extends com.amazonaws.AmazonWebServiceRequest> T requestCreated(T request)
requestCreated in interface AWSAuditEventCallbacksT - type of requestrequest - request request.public <T extends com.amazonaws.AmazonWebServiceRequest> T beforeExecution(T request)
Statistic.AUDIT_REQUEST_EXECUTION;
failures will also increment
Statistic.AUDIT_FAILURE;
Preflight preparation of AWS request.beforeExecution in interface AWSAuditEventCallbacksT - type of requestrequest - requestpublic void afterResponse(com.amazonaws.Request<?> request,
com.amazonaws.Response<?> response)
throws AuditFailureException,
com.amazonaws.SdkBaseException
afterResponse in interface AWSAuditEventCallbacksrequest - requestresponse - response.AuditFailureException - for generic audit failurescom.amazonaws.SdkBaseException - for other reasons.public void afterError(com.amazonaws.Request<?> request,
com.amazonaws.Response<?> response,
Exception exception)
throws AuditFailureException,
com.amazonaws.SdkBaseException
afterError in interface AWSAuditEventCallbacksrequest - requestresponse - response.exception - exception raised.AuditFailureException - for generic audit failurescom.amazonaws.SdkBaseException - for other reasons.public com.amazonaws.AmazonWebServiceRequest beforeMarshalling(com.amazonaws.AmazonWebServiceRequest request)
AWSAuditEventCallbacksbeforeMarshalling in interface AWSAuditEventCallbacksrequest - requestpublic void beforeRequest(com.amazonaws.Request<?> request)
AWSAuditEventCallbacksbeforeRequest in interface AWSAuditEventCallbacksrequest - requestpublic void beforeAttempt(com.amazonaws.handlers.HandlerBeforeAttemptContext context)
AWSAuditEventCallbacksbeforeAttempt in interface AWSAuditEventCallbackscontext - full context, including the request.public void afterAttempt(com.amazonaws.handlers.HandlerAfterAttemptContext context)
AWSAuditEventCallbacksafterAttempt in interface AWSAuditEventCallbackscontext - full context, including the request.public com.amazonaws.http.HttpResponse beforeUnmarshalling(com.amazonaws.Request<?> request,
com.amazonaws.http.HttpResponse httpResponse)
AWSAuditEventCallbacksbeforeUnmarshalling in interface AWSAuditEventCallbacksrequest - request made.httpResponse - response receivedCopyright © 2008–2022 Apache Software Foundation. All rights reserved.