Class Execution.Trace

  • Enclosing class:
    Execution

    public static class Execution.Trace
    extends 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
    • 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​(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​(Object message,
                          int traceLevel)
      • logValue

        public void logValue​(String key,
                             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 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​(String name,
                                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 Object getProperty​(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 String toString()
        Returns a short string description of this
        Overrides:
        toString in class Object