Class IOTracer


  • public class IOTracer
    extends 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 Detail

      • newIOTracer

        @NotNull
        public static @NotNull IOTracer newIOTracer​(@NotNull
                                                    @NotNull Function<IOMonitor,​FileStore> fileStoreFactory,
                                                    @NotNull
                                                    @NotNull Writer output,
                                                    @Nullable
                                                    @Nullable 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 List<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 -