struct

Logit::SpanEvent

Inherits Struct / Value / Object

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)

Constructors

new(name : String, timestamp : Time, attributes : Event::Attributes)
Source

Instance methods

attributes

Structured attributes for this event.

Source
name

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

Source
timestamp

When this event occurred.

Source
to_json(json : JSON::Builder) : Nil

Serialize to JSON

Source