Package

com.ccadllc.cedi

dtrace

Permalink

package dtrace

The distributed trace (dtrace) library provides the means to derive and record a Comcast Money compliant distributed trace across effectful programs given the appropriate typeclasses for that program in implicit scope. The effectful programs are enhanced vai a Kleisli-like data type, TraceT, which encodes the information to calculate and record a trace Span at the conclusion of the program execution.

Source
dtrace.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. dtrace
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class Evaluator[A] extends AnyRef

    Permalink

    Provides the hooks by which the result of a effectful program can be converted into a FailureDetail for use in determining whether the program has failed for the purposes of the trace and how to render that failure.

    Provides the hooks by which the result of a effectful program can be converted into a FailureDetail for use in determining whether the program has failed for the purposes of the trace and how to render that failure. If the traced program fails, the exceptionToFailure function is used to determine if this failure should be recorded as such for the span and if the program itself is successful, the resultToFailure function is used to determine if there is an application level failure embedded in the result and if so, how it should be rendered.

    The default evaluator for a span, if a custom one is not specified, is to treat a failures and successes at the effectful program-level as such for the span, converting the Throwable to a string with the stack trace.

  2. sealed abstract class FailureDetail extends Product with Serializable

    Permalink

    This Alegraic Data Type (ADT) represents a failure of the underlying traced program, providing the means to render the failure when the span is recorded.

  3. final case class Header(name: CaseInsensitiveName, value: Value) extends Product with Serializable

    Permalink

    Represents a general header name/value.

    Represents a general header name/value. Note that though it usually represents an HTTP header, it can be any key/value pair (for instance, a header in an RPC payload).

  4. trait HeaderCodec extends AnyRef

    Permalink

    Describes functionality for encoding or decoding a SpanId to one or more headers.

    Describes functionality for encoding or decoding a SpanId to one or more headers. Protocol specific modules implement this and those implementations can be composed in order to support headers from multiple protocols in the priority order desired by the composer.

  5. case class Note(name: Name, value: Option[Value]) extends Product with Serializable

    Permalink

    This data type represents metadata used to annotate a distributed trace Span.

    This data type represents metadata used to annotate a distributed trace Span. Examples of Notes might be the input parameters to the program being executed as part of the span, or it might be values derived from the result of that program.

    name

    - the human readable name of the Note.

    value

    - the possible value of the Note (or None if a note has no value when the Span is recorded).

  6. case class Span(spanId: SpanId, spanName: Name, startTime: Instant, failure: Option[FailureDetail], duration: FiniteDuration, notes: Vector[Note]) extends Product with Serializable

    Permalink

    Represents a single span for a distributed trace.

    Represents a single span for a distributed trace. A span is the traced execution of an effectful program F.

    spanId

    - the SpanId representing this span's identity and its place in a distributed trace's hiearchy of spans.

    spanName

    - the human readable name of this span - it is the logical name of the effectful program whose execution this span is recording.

    startTime

    - the java.time.Instant representing the timestamp at which the program started execution

    failure

    - the FailureDetail is present and provides a means to render the detail of a program execution failure if the execution failed; otherwise is it not present.

    duration

    - the elapsed time of the execution of the program.

    notes

    - a Vector of Notes used to annotate the program's execution with metadata, which can be derived both from the program's inputs as well as its results.

  7. final case class SpanId(traceId: UUID, parentSpanId: Long, spanId: Long) extends Product with Serializable

    Permalink

    Represents the core identity of a Span.

    Represents the core identity of a Span.

    traceId

    - the globally unique identifier for the trace of which this span is a component.

    parentSpanId

    - the parent identifier of this span. If this span is the root of the trace, this identifier will equal the spanId parameter.

    spanId

    - the identifier of this span. If this span is the root of the trace, this identifier will equal the parentSpanId parameter.

  8. case class TraceContext[F[_]](currentSpan: Span, system: TraceSystem[F]) extends Product with Serializable

    Permalink

    Represents a cursor into the "current" Span and associated system-level metadata and is associated with an effectful program F[A] to realize a trace over that program.

    Represents a cursor into the "current" Span and associated system-level metadata and is associated with an effectful program F[A] to realize a trace over that program.

    F

    - an effectful program type representing the program type of the TraceSystem (which in turn indicates the program type of the TraceSystem's Emitter).

    currentSpan

    - the current Span associated with a particular effectful program.

    system

    - a TraceSystem consisting of system-level metadata which further annotates a Span when recording it along with an implementation of an TraceSystem#Emitter used to perform the recording of the span.

  9. implicit final class TraceEnrichedEffect[F[_], A] extends AnyVal

    Permalink

    Enriches an effectful program F[A] such that TraceT instance methods are made available on it, given the appropriate typeclasses in implicit scope.

  10. type TraceIO[A] = TraceT[IO, A]

    Permalink

    Type alias provided for convenience when using an IO as the type of effectful program being traced.

  11. case class TraceSystem[F[_]](metadata: Map[String, String], emitter: Emitter[F]) extends Product with Serializable

    Permalink

    System level configuration for the trace system.

    System level configuration for the trace system.

    F

    - an effectful program type used to execute the Emitter.

    metadata

    - top-level metadata that should be included in all trace span recordings (examples include: node, deployment, and environment information).

    emitter

    - TraceSystem#Emitter responsible for actually recording the span information for a distributed trace to some external sink (e.g., log file, remote database, JMX, etc.).

  12. final class TraceT[F[_], A] extends AnyRef

    Permalink

    This is the main construct of the library.

    This is the main construct of the library. It represents a function TraceContext => F[A] for an arbitrary F[_], conceptually similiar to a cats.data.Kleisli. The TraceContext holds the "current" Span information for the program F[A] and this information, along with timing and result data derived when F[A] is run, is recorded via the Emitter, also included in the TraceContext, when the F[A] execution is complete. This class is never instantiated by API users; rather, instances are created via as needed via the public instance and companion object methods described below.

    F

    - a type constructor representing the effect which is traced.

    A

    - the result of the effect which is traced.

Value Members

  1. object Evaluator

    Permalink

    This companion object for Evaluator instances provides smart constructors and a default value should no custom Evaluator be used when recording a span.

  2. object FailureDetail extends Serializable

    Permalink

    The FailureDetail companion consists of the enumerated concrete FailureDetail data types.

  3. object Header extends Serializable

    Permalink
  4. object Note extends Serializable

    Permalink

    The companion to the Note instances defines the Note.Name data type and the associated Note.Value ADT, as well as providing convenience constructors for the different value types.

  5. object Span extends Serializable

    Permalink
  6. object SpanId extends Serializable

    Permalink

    Companion object of the SpanId datatype.

    Companion object of the SpanId datatype. Provides smart constructors and commonly used constants.

  7. object TraceIO

    Permalink

    Companion to the TraceIO[A] type alias - provides the TraceT smart constructors with the effectful program F fixed as IO.

  8. object TraceSystem extends Serializable

    Permalink
  9. object TraceT extends TraceTPolyFunctions with TraceTInstances

    Permalink

    The TraceT companion provides smart constructors for desired TraceT instances and type class isntances.

Inherited from AnyRef

Inherited from Any

Ungrouped