abstract class OpenTelemetry::Trace::Tracer

Overview

Starts spans for an instrumentation scope. Concurrency: safe for concurrent use. Implementers must preserve this guarantee.

Direct Known Subclasses

Defined in:

api/trace/tracer.cr

Instance Method Summary

Instance Method Detail

abstract def do_start_span(name : String, parent : Context, kind : SpanKind, attributes : Attributes, links : Array(Link), start_time : Time | Nil) : Span #

SPI: implementers override. Applications call #start_span or #in_span.


[View source]
abstract def enabled? : Bool #

Indicates whether creating spans can result in recording. Call this before each span creation to skip expensive work when tracing is disabled. The result can change between calls.


[View source]
def in_span(name : String, *, context : Context | Nil = nil, kind : SpanKind = SpanKind::Internal, attributes = nil, links : Enumerable(Link) | Nil = nil, start_time : Time | Nil = nil, record_exception : Bool = true, & : Span -> U) : U forall U #

Starts a span, activates it for the block, and ends it when the block exits. Prefer passing attributes known at creation in attributes: because samplers can only consider attributes supplied at span creation. Pass links available at creation as links: to make them visible to head samplers. Exceptions from the block propagate to the caller.


[View source]
def start_span(name : String, *, context : Context | Nil = nil, kind : SpanKind = SpanKind::Internal, attributes = nil, links : Enumerable(Link) | Nil = nil, start_time : Time | Nil = nil) : Span #

Starts a span. Prefer passing attributes known at creation in attributes: because samplers can only consider attributes supplied at span creation. Pass links available at creation as links: to make them visible to head samplers.


[View source]