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:
- 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 attempts to override a terminal trace id will be ignored.
- Alphabetic
- By Inheritance
- TraceId
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags)
- new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags, traceIdHigh: Option[SpanId])
- new TraceId(_traceId: Option[SpanId], _parentId: Option[SpanId], spanId: SpanId, _sampled: Option[Boolean], flags: Flags, traceIdHigh: Option[SpanId] = None, terminal: Boolean = false)
- _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 attempts to override a terminal trace id will be ignored.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val _parentId: Option[SpanId]
- val _sampled: Option[Boolean]
- val _traceId: Option[SpanId]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
- Definition Classes
- TraceId → Equals → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- val flags: Flags
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getSampleRate(): Float
Convenience method for getting sampleRate from id flags
- def getSampled(): Option[Boolean]
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>
- def hashCode(): Int
- Definition Classes
- TraceId → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def parentId: SpanId
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def sampled: Option[Boolean]
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.
- val spanId: SpanId
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val terminal: Boolean
- def toString(): String
- Definition Classes
- TraceId → AnyRef → Any
- def traceId: SpanId
- val traceIdHigh: Option[SpanId]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()