struct Logit::SpanEvent

Overview

Represents an event that occurred during a span's lifetime.

Span events are intermediate logs attached to a span, similar to OpenTelemetry's Span Events. They capture significant moments during a span's execution without creating separate spans.

Example

span.add_event("cache.hit", key: "user:123")
span.add_event("db.query.started", table: "users")
span.add_event("db.query.completed", rows: 42)

Defined in:

logit/tracing/span.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, timestamp : Time, attributes : Event::Attributes) #

[View source]

Instance Method Detail

def attributes : Event::Attributes #

Structured attributes for this event.


[View source]
def name : String #

Name of this event (e.g., "cache.hit", "db.query.started").


[View source]
def timestamp : Time #

When this event occurred.


[View source]
def to_json(json : JSON::Builder) : Nil #

Serialize to JSON


[View source]