OpenTracing : Theory & Practice

V.N. Nikhil Anurag

Brief Overview

TracerContext

Live Coding

Brief Overview

TracerContext

Live Demo

Brief Overview

Root Span

Incoming Request

Child Spans

...

Child Spans

Root Span

Outgoing Response

Service

Brief Overview

TraceContext

Live Coding

TracerContext

# Steps to create Root Span
* Extract HTTP Headers from request.
* Create SpanContext from HTTP Headers, if available.
* Extract FlowId, if applicable.
* Create SpanBuilder with relevant tags.
* Build Root Span from SpanBuilder and SpanContext (FINALLY!)
* Tag Root Span with relevant info.

# Steps to use a Span
* Execute code using new span as child of root/parent span.
* Execute code using current span.
* Remember to close a span (Important!)
* Log info on current Span.
* Log Error on current Span with special tags and proper formatting.

TracerContext

trait TracerContext {
  def withChildSpan(spanName, additionalTags): Resource[IO, TracerContext]

  def withCurrentSpan(additionalTags): Resource[IO, TracerContext]

  def logToSpan(msg): IO[TracerContext]

  def logErrorOnSpan(err): IO[Unit]

  def closeSpan(span): IO[Unit]
}

trait TracerContextObject {
  def createSpanBuilder(spanName, tags, tracer): IO[SpanBuilder]

  def build(flowId, spanName, tracer, tags): IO[TracerContext]

  def tagSpan(spanBuilder, tags): IO[SpanBuilder]

  def extractFrom(headers, rootSpanName, tracer): IO[TracerContext]

  def trySpanCtxExtraction(adapter, tracer): IO[Option[SpanContext]]
}

Brief Overview

TracerContext

Live Coding

Live Coding (Setup)

  • Source Code @
    https://github.com/last-ent/http4s-opentracing

     

  • Jaeger Executables @
    https://www.jaegertracing.io/download/

Live Coding (Oops!)

You should've seen...

OpenTracing : Theory & Practice

Questions?

Feedback?

Made with Slides.com