Class/Object

com.twitter.finagle.tracing

TraceId

Related Docs: object TraceId | package tracing

Permalink

final case class TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags, traceIdHigh: Option[SpanId] = None, terminal: Boolean = false) extends Product with Serializable

A trace id represents one particular trace for one request.

A request is composed of one or more spans, which are generally RPCs but may be other in-process activity. The TraceId for each span is a tuple of three ids:

  1. a shared id common to all spans in an overall request (trace id) 2. an id unique to this part of the request (span id) 3. an id for the parent request that caused this span (parent id)

For example, when service M calls service N, they may have respective TraceIds like these:

           TRACE ID         SPAN ID           PARENT ID
SERVICE M  e4bbb7c0f6a2ff07.a5f47e9fced314a2<:694eb2f05b8fd7d1
                  |                |
                  |                +-----------------+
                  |                                  |
                  v                                  v
SERVICE N  e4bbb7c0f6a2ff07.263edc9b65773b08<:a5f47e9fced314a2

Parent id and trace id are optional when constructing a TraceId because they are not present for the very first span in a request. In this case all three ids in the resulting TraceId are the same:

           TRACE ID         SPAN ID           PARENT ID
SERVICE A  34429b04b6bbf478.34429b04b6bbf478<:34429b04b6bbf478
_traceId

The low 64bits of the id for this request.

_parentId

The id for the request one step up the service stack.

spanId

The id for this particular request

_sampled

Should we sample this request or not? True means sample, false means don't, none means we defer decision to someone further down in the stack.

flags

Flags relevant to this request. Could be things like debug mode on/off. The sampled flag could eventually be moved in here.

traceIdHigh

The high 64bits of the id for this request, when the id is 128bits.

terminal

Whether this trace id is terminal. Any attemtps to override a terminal trace id will be ignored.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TraceId
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags)

    Permalink
  2. new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags, traceIdHigh: Option[SpanId])

    Permalink
  3. new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags, traceIdHigh: Option[SpanId] = None, terminal: Boolean = false)

    Permalink

    _traceId

    The low 64bits of the id for this request.

    _parentId

    The id for the request one step up the service stack.

    spanId

    The id for this particular request

    _sampled

    Should we sample this request or not? True means sample, false means don't, none means we defer decision to someone further down in the stack.

    flags

    Flags relevant to this request. Could be things like debug mode on/off. The sampled flag could eventually be moved in here.

    traceIdHigh

    The high 64bits of the id for this request, when the id is 128bits.

    terminal

    Whether this trace id is terminal. Any attemtps to override a terminal trace id will be ignored.

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. val _parentId: Option[SpanId]

    Permalink

    The id for the request one step up the service stack.

  5. val _sampled: Option[Boolean]

    Permalink

    Should we sample this request or not? True means sample, false means don't, none means we defer decision to someone further down in the stack.

  6. val _traceId: Option[SpanId]

    Permalink

    The low 64bits of the id for this request.

  7. final def asInstanceOf[T0]: T0

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

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

    Permalink
    Definition Classes
    AnyRef
  10. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    TraceId → Equals → AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. val flags: Flags

    Permalink

    Flags relevant to this request.

    Flags relevant to this request. Could be things like debug mode on/off. The sampled flag could eventually be moved in here.

  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def getSampled(): Option[Boolean]

    Permalink

    Java-friendly API to convert sampled to a Option of java.lang.Boolean.

    Java-friendly API to convert sampled to a Option of java.lang.Boolean.

    Since

    Java generics require objects, using sampled from Java would give an Option<Object> instead of Option<Boolean>

  15. def hashCode(): Int

    Permalink
    Definition Classes
    TraceId → AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  20. def parentId: SpanId

    Permalink
  21. def sampled: Option[Boolean]

    Permalink

    Override _sampled to Some(true) if the debug flag is set.

    Override _sampled to Some(true) if the debug flag is set.

    See also

    getSampled for a Java-friendly API.

  22. val spanId: SpanId

    Permalink

    The id for this particular request

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

    Permalink
    Definition Classes
    AnyRef
  24. val terminal: Boolean

    Permalink

    Whether this trace id is terminal.

    Whether this trace id is terminal. Any attemtps to override a terminal trace id will be ignored.

  25. def toString(): String

    Permalink
    Definition Classes
    TraceId → AnyRef → Any
  26. def traceId: SpanId

    Permalink
  27. val traceIdHigh: Option[SpanId]

    Permalink

    The high 64bits of the id for this request, when the id is 128bits.

  28. final def wait(): Unit

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

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

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

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped