Class Execution.Trace

  • Enclosing class:
    Execution

    public static class Execution.Trace
    extends java.lang.Object
    Tre trace of this execution. This is a facade into a node in the larger trace tree which captures the information about all executions caused by some request
    Author:
    bratseth
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Execution.Trace.Level
      Defines what information is added at which trace level
      static class  Execution.Trace.LogValue
      An immutable access log value added to the trace
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <VISITOR extends com.yahoo.yolean.trace.TraceVisitor>
      VISITOR
      accept​(VISITOR visitor)
      Visits the entire trace tree
      Execution.Trace createChild()
      Creates a trace node below a parent
      static Execution.Trace createRoot​(int traceLevel)
      Creates an empty root trace with a given level of tracing
      boolean getForceTimestamps()  
      java.lang.Object getProperty​(java.lang.String name)
      Returns a property set anywhere in the trace tree this points to.
      int getTraceLevel()
      Returns the maximum trace level this will record
      void logValue​(java.lang.String key, java.lang.String value)
      Adds a key-value which will be logged to the access log of this request.
      java.util.Iterator<Execution.Trace.LogValue> logValueIterator()
      Returns the values that should be written to the access log set in the entire trace node tree
      void setForceTimestamps​(boolean forceTimestamps)  
      void setProperty​(java.lang.String name, java.lang.Object value)
      Adds a property key-value to this trace.
      void setTraceLevel​(int traceLevel)
      Sets the maximum trace level this will record
      java.lang.String toString()
      Returns a short string description of this
      void trace​(java.lang.Object message, int traceLevel)  
      void trace​(java.lang.String message, int traceLevel)
      Adds a trace message to this trace, if this trace has at most the given trace level
      com.yahoo.yolean.trace.TraceNode traceNode()
      Returns the trace node peer of this
      • Methods inherited from class java.lang.Object

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

      • createRoot

        public static Execution.Trace createRoot​(int traceLevel)
        Creates an empty root trace with a given level of tracing
      • createChild

        public Execution.Trace createChild()
        Creates a trace node below a parent
      • getTraceLevel

        public int getTraceLevel()
        Returns the maximum trace level this will record
      • setTraceLevel

        public void setTraceLevel​(int traceLevel)
        Sets the maximum trace level this will record
      • setForceTimestamps

        public void setForceTimestamps​(boolean forceTimestamps)
      • getForceTimestamps

        public boolean getForceTimestamps()
      • trace

        public void trace​(java.lang.String message,
                          int traceLevel)
        Adds a trace message to this trace, if this trace has at most the given trace level
      • trace

        public void trace​(java.lang.Object message,
                          int traceLevel)
      • logValue

        public void logValue​(java.lang.String key,
                             java.lang.String value)
        Adds a key-value which will be logged to the access log of this request. Multiple values may be set to the same key. A value cannot be removed once set, but it can be overwritten by adding another value for the same key.
      • logValueIterator

        public java.util.Iterator<Execution.Trace.LogValue> logValueIterator()
        Returns the values that should be written to the access log set in the entire trace node tree
      • accept

        public <VISITOR extends com.yahoo.yolean.trace.TraceVisitor> VISITOR accept​(VISITOR visitor)
        Visits the entire trace tree
        Returns:
        the argument visitor for convenience
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object value)
        Adds a property key-value to this trace. Values are looked up by reverse depth-first search in the trace node tree.
        Parameters:
        name - the name of the property
        value - the value of the property, or null to set this property to null
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Returns a property set anywhere in the trace tree this points to. Note that even though this call is itself "thread robust", the object values returned may in some scenarios not be written behind a synchronization barrier, so when accessing objects which are not inherently thread safe, synchronization should be considered.

        This method have a time complexity which is proportional to the number of trace nodes in the tree

        Returns:
        the value of this property, or null if none
      • traceNode

        public com.yahoo.yolean.trace.TraceNode traceNode()
        Returns the trace node peer of this
      • toString

        public java.lang.String toString()
        Returns a short string description of this
        Overrides:
        toString in class java.lang.Object