V.N. Nikhil Anurag
Root Span
Incoming Request
Child Spans
...
Child Spans
Root Span
Outgoing Response
# 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.
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]]
}
Source Code @
https://github.com/last-ent/http4s-opentracing
Jaeger Executables @
https://www.jaegertracing.io/download/
You should've seen...