Class AbstractOperationAuditor

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.fs.s3a.audit.impl.AbstractOperationAuditor
All Implemented Interfaces:
Closeable, AutoCloseable, OperationAuditor, org.apache.hadoop.fs.statistics.IOStatisticsSource, org.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A>, org.apache.hadoop.service.Service
Direct Known Subclasses:
LoggingAuditor, NoopAuditor

public abstract class AbstractOperationAuditor extends org.apache.hadoop.service.AbstractService implements OperationAuditor
This is a long-lived service which is created in S3A FS initialize (make it fast!) which provides context for tracking operations made to S3. An IOStatisticsStore is passed in -in production this is expected to be the S3AFileSystem instrumentation, which will have the AUDIT_SPAN_START statistic configured for counting durations.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Base of IDs is a UUID.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Construct.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Notification that the auditor flags have been updated.
    protected final String
    Create a span ID.
    Get the current set of auditor flags.
    Get the Auditor ID.
    org.apache.hadoop.fs.statistics.impl.IOStatisticsStore
    Get the IOStatistics Store.
    Get the options this auditor was initialized with.
    void
    Sets the IOStats and then calls init().
    protected boolean
    Should out of scope ops be rejected?
    protected void
    serviceInit(org.apache.hadoop.conf.Configuration conf)
     
    void
    Update Auditor flags.
    protected void
    setRejectOutOfSpan(boolean rejectOutOfSpan)
    Enable/disable out of span rejection.

    Methods inherited from class org.apache.hadoop.service.AbstractService

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.fs.store.audit.AuditSpanSource

    createSpan

    Methods inherited from interface org.apache.hadoop.fs.s3a.audit.OperationAuditor

    checkAccess, getUnbondedSpan, noteSpanReferenceLost

    Methods inherited from interface org.apache.hadoop.service.Service

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
  • Field Details

    • BASE

      public static final String BASE
      Base of IDs is a UUID.
  • Constructor Details

    • AbstractOperationAuditor

      protected AbstractOperationAuditor(String name)
      Construct.
      Parameters:
      name - name
  • Method Details

    • init

      public void init(OperationAuditorOptions opts)
      Sets the IOStats and then calls init().
      Specified by:
      init in interface OperationAuditor
      Parameters:
      opts - options to initialize with.
    • serviceInit

      protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • getAuditorId

      public String getAuditorId()
      Description copied from interface: OperationAuditor
      Get the Auditor ID.
      Specified by:
      getAuditorId in interface OperationAuditor
      Returns:
      ID
    • getIOStatistics

      public org.apache.hadoop.fs.statistics.impl.IOStatisticsStore getIOStatistics()
      Get the IOStatistics Store.
      Specified by:
      getIOStatistics in interface org.apache.hadoop.fs.statistics.IOStatisticsSource
      Returns:
      the IOStatistics store updated with statistics.
    • getOptions

      protected OperationAuditorOptions getOptions()
      Get the options this auditor was initialized with.
      Returns:
      options.
    • createSpanID

      protected final String createSpanID()
      Create a span ID.
      Returns:
      a unique span ID.
    • isRejectOutOfSpan

      protected boolean isRejectOutOfSpan()
      Should out of scope ops be rejected?
      Returns:
      true if out of span calls should be rejected.
    • setRejectOutOfSpan

      protected void setRejectOutOfSpan(boolean rejectOutOfSpan)
      Enable/disable out of span rejection.
      Parameters:
      rejectOutOfSpan - new value.
    • setAuditFlags

      public void setAuditFlags(EnumSet<AuditorFlags> flags)
      Update Auditor flags. Calls auditorFlagsChanged(EnumSet) after the update.
      Specified by:
      setAuditFlags in interface OperationAuditor
      Parameters:
      flags - audit flags.
    • getAuditorFlags

      public EnumSet<AuditorFlags> getAuditorFlags()
      Get the current set of auditor flags.
      Returns:
      the current set of auditor flags.
    • auditorFlagsChanged

      protected void auditorFlagsChanged(EnumSet<AuditorFlags> flags)
      Notification that the auditor flags have been updated.
      Parameters:
      flags - audit flags.