org.apache.cassandra.tracing

## Class Tracing

- java.lang.Object
- - org.apache.cassandra.tracing.Tracing

- All Implemented Interfaces:
    ExecutorLocal<TraceState>

      public class Tracing
      extends java.lang.Object
      implements ExecutorLocal<TraceState>

  A trace session context. Able to track and store trace sessions. A session is usually a user initiated query, and may have multiple local and remote events before it is completed. All events and sessions are stored at keyspace.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Tracing.TraceType`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Tracing` | `instance`
    `static java.lang.String` | `TRACE_HEADER`
    `static java.lang.String` | `TRACE_TYPE`

    - ### Fields inherited from interface org.apache.cassandra.concurrent.ExecutorLocal

      `all`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Tracing()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TraceState` | `begin(java.lang.String request, java.net.InetAddress client, java.util.Map<java.lang.String,java.lang.String> parameters)`
    `TraceState` | `begin(java.lang.String request, java.util.Map<java.lang.String,java.lang.String> parameters)`
    `void` | `doneWithNonLocalSession(TraceState state)`
    `TraceState` | `get()` This is called when scheduling the task, and also before calling `ExecutorLocal#set(T)` when running on a executor thread.
    `TraceState` | `get(java.util.UUID sessionId)`
    `java.util.UUID` | `getSessionId()`
    `Tracing.TraceType` | `getTraceType()`
    `int` | `getTTL()`
    `TraceState` | `initializeFromMessage(MessageIn<?> message)` Determines the tracing context from a message.
    `static boolean` | `isTracing()` Indicates if the current thread's execution is being traced.
    `java.util.UUID` | `newSession()`
    `java.util.UUID` | `newSession(Tracing.TraceType traceType)`
    `java.util.UUID` | `newSession(java.util.UUID sessionId)`
    `void` | `set(TraceState tls)` Before a task has been run, this will be called with the value from the thread that scheduled the task, and after the task is finished, the value that was previously retrieved from this thread is restored.
    `void` | `stopSession()` Stop the session and record its complete.
    `static void` | `trace(java.lang.String message)`
    `static void` | `trace(java.lang.String format, java.lang.Object... args)`
    `static void` | `trace(java.lang.String format, java.lang.Object arg)`
    `static void` | `trace(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)`
    `static void` | `traceRepair(java.lang.String format, java.lang.Object... args)`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### TRACE_HEADER

          public static final java.lang.String TRACE_HEADER

      See Also:
        Constant Field Values

    - #### TRACE_TYPE

          public static final java.lang.String TRACE_TYPE

      See Also:
        Constant Field Values

    - #### instance

          public static final Tracing instance

  - ### Constructor Detail

    - #### Tracing

          public Tracing()

  - ### Method Detail

    - #### getSessionId

          public java.util.UUID getSessionId()

    - #### getTraceType

          public Tracing.TraceType getTraceType()

    - #### getTTL

          public int getTTL()

    - #### isTracing

          public static boolean isTracing()

      Indicates if the current thread's execution is being traced.

    - #### newSession

          public java.util.UUID newSession()

    - #### newSession

          public java.util.UUID newSession(Tracing.TraceType traceType)

    - #### newSession

          public java.util.UUID newSession(java.util.UUID sessionId)

    - #### doneWithNonLocalSession

          public void doneWithNonLocalSession(TraceState state)

    - #### stopSession

          public void stopSession()

      Stop the session and record its complete. Called by coodinator when request is complete.

    - #### get

          public TraceState get()

      Description copied from interface: `ExecutorLocal`
      This is called when scheduling the task, and also before calling `ExecutorLocal#set(T)` when running on a executor thread.
      Specified by:
        `get` in interface `ExecutorLocal<TraceState>`
      Returns:
        The thread-local value that we want to copy across executor boundaries; may be null if not set.

    - #### get

          public TraceState get(java.util.UUID sessionId)

    - #### set

          public void set(TraceState tls)

      Description copied from interface: `ExecutorLocal`
      Before a task has been run, this will be called with the value from the thread that scheduled the task, and after the task is finished, the value that was previously retrieved from this thread is restored.
      Specified by:
        `set` in interface `ExecutorLocal<TraceState>`
      Parameters:
        `tls` - Value to use for the executor local state; may be null.

    - #### begin

          public TraceState begin(java.lang.String request,
                                  java.util.Map<java.lang.String,java.lang.String> parameters)

    - #### begin

          public TraceState begin(java.lang.String request,
                                  java.net.InetAddress client,
                                  java.util.Map<java.lang.String,java.lang.String> parameters)

    - #### initializeFromMessage

          public TraceState initializeFromMessage(MessageIn<?> message)

      Determines the tracing context from a message. Does NOT set the threadlocal state.
      Parameters:
        `message` - The internode message

    - #### traceRepair

          public static void traceRepair(java.lang.String format,
                                         java.lang.Object... args)

    - #### trace

          public static void trace(java.lang.String message)

    - #### trace

          public static void trace(java.lang.String format,
                                   java.lang.Object arg)

    - #### trace

          public static void trace(java.lang.String format,
                                   java.lang.Object arg1,
                                   java.lang.Object arg2)

    - #### trace

          public static void trace(java.lang.String format,
                                   java.lang.Object... args)

Copyright © 2018 The Apache Software Foundation