class OpenTelemetry::Trace
- OpenTelemetry::Trace
- Reference
- Object
Included Modules
Defined in:
trace.crtrace/exceptions.cr
Constant Summary
-
MATCH =
/(?<trace_id>[A-Fa-f0-9]{32})/
Constructors
Class Method Summary
- .current_span
- .current_trace
-
.prng : Random::PCG32
This returns the currently initialized random number generator.
-
.validate_id(id : Slice(Uint8))
Take a slice of UInt8 (
Bytes
) and determine if it is a valid trace_id. -
.validate_id(id : String)
Take a string and determine if it is a valid trace_id.
Instance Method Summary
-
#[](key)
Get the value of an attribute on the
Resource
that is attached to this trace. -
#[]=(key, value)
Set an attribute on the
Resource
that is attached to this trace. -
#[]?(key)
Get the value of an attribute on the
Resource
that is attached to this trace, or nil if the key does not exist. -
#close_span(span = OpenTelemetry.current_span)
Close a previosly opened span.
- #current_span : Span | Nil
- #current_span=(current_span : Span | Nil)
-
#exporter
This returns the exporter that this trace will be exported to.
-
#get_attribute(key)
An alias for
#[]
-
#id
Return the trace_id for this trace.
-
#in_span(span_name)
Start a new span in the current trace.
-
#in_span(span_name, &)
Start a new span in the current trace.
-
#merge_configuration_from_provider=(val : OpenTelemetry::TraceProvider)
Merge the configuration from a given
TraceProvider
into the configuration for this trace's TraceProvider. - #output_stack : Deque(Span)
- #provider : TraceProvider
-
#provider=(val : OpenTelemetry::TraceProvider)
Set the
TraceProvider
for this trace. - #resource : Resource
- #schema_url : String
- #schema_url=(schema_url : String)
-
#service_name : String
Return the service name of this trace.
-
#service_name=(val : String)
Set the service name of this trace.
-
#service_version : String
Return the service version of this trace.
-
#service_version=(val : String)
Set the service version of this trace.
-
#set_attribute(key, value)
An alias for
#[]=
- #set_sampling(span)
- #span_context : SpanContext
- #span_context=(span_context : SpanContext)
- #span_stack : Array(Span)
- #to_json(json : JSON::Builder)
- #to_json
-
#to_protobuf
This method returns a ProtoBuf object containing all of the Trace information.
- #trace_id : Slice(UInt8)
- #trace_id=(trace_id : Slice(UInt8))
Instance methods inherited from module OpenTelemetry::Sendable
size
size,
to_json
to_json,
to_protobuf
to_protobuf
Constructor Detail
Class Method Detail
Returns the currently active Tracer
in the current fiber, or nil if there is no currently active Tracer
.
This returns the currently initialized random number generator. The Crystal OpenTelemetry currently utilizes only the PCG32 algorithm, as in earlier versions of Crystal, the Random::ISAAC algorithm, which is arguably superior to the PCG32 algorithm, was not concurrency-safe, and would cause strange and unpleasant problems under heavy concurrent loads. If/when it is determined that this is no longer an issue, the library will support both algorithms, but will default to the ISAAC algorithm.
Take a slice of UInt8 (Bytes
) and determine if it is a valid trace_id.
Take a string and determine if it is a valid trace_id.
Instance Method Detail
Get the value of an attribute on the Resource
that is attached to this trace. This will throw an exception if the key does not exist.
Get the value of an attribute on the Resource
that is attached to this trace, or nil if the key does not exist.
Start a new span in the current trace. A matching #close_span
call must be made to complete the span.
Start a new span in the current trace. The block provided will be executed within the context of the new span, and the span will be closed automatically when the block returns.
Merge the configuration from a given TraceProvider
into the configuration for this trace's TraceProvider.