Class/Object

com.twitter.finagle.tracing

Tracing

Related Docs: object Tracing | package tracing

Permalink

abstract class Tracing extends AnyRef

This is a tracing system similar to Dapper:

“Dapper, a Large-Scale Distributed Systems Tracing Infrastructure”, Benjamin H. Sigelman, Luiz André Barroso, Mike Burrows, Pat Stephenson, Manoj Plakal, Donald Beaver, Saul Jaspan, Chandan Shanbhag, 2010.

It is meant to be independent of whatever underlying RPC mechanism is being used, and it is up to the underlying codec to implement the transport.

Trace (a singleton object) maintains the state of the tracing stack stored in com.twitter.finagle.context.Contexts. The current TraceId has a terminal flag, indicating whether it can be overridden with a different TraceId. Setting the current TraceId as terminal forces all future annotation to share that TraceId. When reporting, we report to all tracers in the list of Tracers.

The Tracing API is structured in a way it's caller's responsibility to check if the current stack of tracers is actively tracing (Trace.isActivelyTracing) to avoid unnecessarily allocations.

It's recommended to "capture" a Tracing instance while performing multiple tracing operations to minimize the number of com.twitter.finagle.context.Contexts lookups and increase throughput.

// Performs six context lookups (two for isActivelyTracing, two for each record call).
if (Trace.isActivelyTracing()) {
  Trace.record("foo")
  Trace.record("foo")
}

// Performs just two context lookups and captures the results in the `Trace` instance.
val trace = Trace()
if (trace.isActivelyTracing) {
  trace.record("foo")
  trace.record("bar")
}
Note

Use Trace.getInstance() and Trace.newInstance() in Java.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Tracing
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Tracing()

    Permalink

Abstract Value Members

  1. abstract def idOption: Option[TraceId]

    Permalink

    Get the current identifier, if it exists.

  2. abstract def tracers: List[Tracer]

    Permalink

    returns

    the current list of tracers

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hasId: Boolean

    Permalink

    True if there is an identifier for the current trace.

  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def id: TraceId

    Permalink

    Get the current trace identifier.

    Get the current trace identifier. If no identifiers have been pushed, a default one is provided.

  13. final def isActivelyTracing: Boolean

    Permalink

    Return true if tracing is enabled with a good tracer pushed and at least one tracer decides to actively trace the current id.

  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def isTerminal: Boolean

    Permalink

    Return true if the current trace id is terminal.

  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def nextId: TraceId

    Permalink

    Create a derived id from the current TraceId.

  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def record(message: String, duration: Duration): Unit

    Permalink
  21. final def record(message: String): Unit

    Permalink
  22. final def record(ann: Annotation, duration: Duration): Unit

    Permalink
  23. final def record(ann: Annotation): Unit

    Permalink
  24. final def record(rec: Record): Unit

    Permalink

    Record a raw Record.

    Record a raw Record. This will record to a _unique_ set of tracers in the stack.

  25. final def recordBinaries(annotations: Map[String, Any]): Unit

    Permalink
  26. final def recordBinary(key: String, value: Any): Unit

    Permalink
  27. final def recordClientAddr(ia: InetSocketAddress): Unit

    Permalink
  28. final def recordClientRecv(): Unit

    Permalink
  29. final def recordClientRecvError(error: String): Unit

    Permalink
  30. final def recordClientRecvFragment(): Unit

    Permalink
  31. final def recordClientSend(): Unit

    Permalink
  32. final def recordClientSendFrargmet(): Unit

    Permalink
  33. final def recordLocalAddr(ia: InetSocketAddress): Unit

    Permalink
  34. final def recordRpc(name: String): Unit

    Permalink
  35. final def recordServerAddr(ia: InetSocketAddress): Unit

    Permalink
  36. final def recordServerRecv(): Unit

    Permalink
  37. final def recordServerRecvFragment(): Unit

    Permalink
  38. final def recordServerSend(): Unit

    Permalink
  39. final def recordServerSendError(error: String): Unit

    Permalink
  40. final def recordServerSendFragment(): Unit

    Permalink
  41. final def recordServiceName(serviceName: String): Unit

    Permalink
  42. final def recordWireRecv(): Unit

    Permalink
  43. final def recordWireRecvError(error: String): Unit

    Permalink
  44. final def recordWireSend(): Unit

    Permalink
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  46. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  47. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped