Private constructorStatic Private contextStatic Private Optional correlationStatic Private eventStatic Private instanceStatic Private isStatic Private metadataStatic Private parentStatic Private samplingStatic Private serviceStatic Private spansStatic Private tracePrivate addPrivate createOutput the tracer configuration, for example for debugging needs.
Private getGet an individual span by name.
Private getGet an individual span by ID.
Returns a string that can be used as the
content of a W3C traceparent HTTP header.
Private initSet the parent context. Use this if you want to automatically assign a span as the parent for any future spans.
Call it with an empty string to reset it.
tracer.setParentContext('FullSpan')
tracer.setParentContext('')
This value will be propagated to all future spans.
Private shouldStart a new trace. This will typically be automatically assigned to the parent trace if one exists. Optionally you can pass in the name of a parent span to link it to its trace ID.
https://docs.honeycomb.io/getting-data-in/tracing/send-trace-data/
A root span, the first span in a trace, does not have a parent. As you
instrument your code, make sure every span propagates its `trace.trace_id`
and` trace.span_id` to any child spans it calls, so that the child span can
use those values as its `trace.trace_id` and `trace.parent_id`. Honeycomb uses
these relationships to determine the order spans execute and construct the
waterfall diagram.
Optional parentSpanName: stringIf provided, this will override any existing parent context for this particular trace.
Static continueReturns the current instance of MikroTrace without resetting anything or otherwise affecting the current state.
Static enrichEnrich MikroTrace with values post-initialization.
Static resetStatic setStatic startThis instantiates MikroTrace. In order to be able to "remember" event and context we use a singleton pattern to reuse the same logical instance.
If the start method receives any input, that input will
overwrite any existing metadata.
If you want to "add" to these, you should instead call
enrich() and pass in your additional data there.
Running this without input will also force a new traceId.
Optional input: MikroTraceInputGenerated using TypeDoc
Description
Custom basic tracer that mildly emulates OpenTelemetry semantics and behavior. Built as a ligher-weight way to handle spans in technical contexts (like AWS Lambda) where OTel tooling seems brittle at best.
Make sure to reuse the same instance across your application to get it working as intended.
MikroTrace simplifies the OTel model a bit: