lightspeed/ops/telemetry

Metrics and tracing primitives for production observability.

Types

Metric point.

pub type Metric {
  Counter(name: String, value: Int, tags: List(Tag))
  Gauge(name: String, value: Int, tags: List(Tag))
}

Constructors

  • Counter(name: String, value: Int, tags: List(Tag))
  • Gauge(name: String, value: Int, tags: List(Tag))

Trace span.

pub type Span {
  Span(
    name: String,
    session_id: String,
    start_ms: Int,
    end_ms: Int,
    status: SpanStatus,
    tags: List(Tag),
  )
}

Constructors

  • Span(
      name: String,
      session_id: String,
      start_ms: Int,
      end_ms: Int,
      status: SpanStatus,
      tags: List(Tag),
    )

Span status.

pub type SpanStatus {
  SpanOk
  SpanError(reason: String)
}

Constructors

  • SpanOk
  • SpanError(reason: String)

One metric tag.

pub type Tag {
  Tag(key: String, value: String)
}

Constructors

  • Tag(key: String, value: String)

Values

pub fn from_session_event(
  event: session.TelemetryEvent,
) -> List(Metric)

Translate one session telemetry event into metric points.

pub fn metric_line(metric: Metric) -> String

Render one metric as a log-friendly line.

pub fn receive_span(
  session_id: String,
  frame_tag: String,
  start_ms: Int,
  end_ms: Int,
  status: SpanStatus,
) -> Span

Build a receive span for transport traces.

pub fn span_status_label(status: SpanStatus) -> String

Convert span status to a stable label.

Search Document