Class IOTracer


  • public class IOTracer
    extends java.lang.Object
    This utility class allows collecting IO traces of read accesses to segments caused by reading specific items.

    An instance of Trace is used to specify a read pattern. Segment reads are recorded in CSV format:

     timestamp,file,segmentId,length,elapsed
     1522147945084,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,171849
     1522147945096,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,131272
     1522147945097,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,142766
     ...
     
    Trace implementations can specify an additional context, which is recorded with each line of the CSV output. A context is simply a list of additional fields as specified during instantiation of an IOTracer.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collectTrace​(@NotNull Trace trace)
      Collect a IO trace.
      static @NotNull IOTracer newIOTracer​(@NotNull java.util.function.Function<IOMonitor,​FileStore> fileStoreFactory, @NotNull java.io.Writer output, @Nullable java.lang.String contextSpec)
      Create a new IOTracer instance.
      void setContext​(@NotNull java.util.List<java.lang.String> context)
      Set the context to be added to each line of the IOTrace going forward.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • newIOTracer

        @NotNull
        public static @NotNull IOTracer newIOTracer​(@NotNull
                                                    @NotNull java.util.function.Function<IOMonitor,​FileStore> fileStoreFactory,
                                                    @NotNull
                                                    @NotNull java.io.Writer output,
                                                    @Nullable
                                                    @Nullable java.lang.String contextSpec)
        Create a new IOTracer instance.
        Parameters:
        fileStoreFactory - A factory for creating a FileStore with the passed IOMonitor for monitoring segment IO.
        output - The target for the CSV formatted IO trace.
        contextSpec - The specification of additional context provided by the traces being run. A trace consists of a comma separated list of values, which must match the list of values passed to setContext(List).
        Returns:
        A new IOTracer instance.
      • collectTrace

        public void collectTrace​(@NotNull
                                 @NotNull Trace trace)
        Collect a IO trace.
        Parameters:
        trace -
      • setContext

        public void setContext​(@NotNull
                               @NotNull java.util.List<java.lang.String> context)
        Set the context to be added to each line of the IOTrace going forward. The list of values needs to match the context specification passed to newIOTracer(Function, Writer, String).
        Parameters:
        context -