Skip to content

Operations and Observability

Pt edited this page Jun 17, 2026 · 1 revision

This page covers how to operate Lc inside long-running services and critical toolchains.

Context strategy

Use:

  • ProcessStringWithCtx
  • ProcessBytesWithCtx

Propagate context from:

  • API requests,
  • worker jobs,
  • shutdown signals.

This allows deterministic cancellation and timeout behavior.

Logging strategy

core.Logger provides:

  • structured status/time/message formatting,
  • status-specific format overrides,
  • in-memory log buffer retrieval.

Default runtime also emits call-event start/end debug logs through event hooks.

Event instrumentation

Attach event handlers for:

  • latency metrics,
  • error counters,
  • audit records,
  • trace annotations.

Because event flow is centralized, instrumentation remains consistent across commands.

Scope governance

Recommended rules:

  • reserve key namespaces,
  • avoid ambiguous key names,
  • keep value types stable,
  • validate required keys at boundaries.

Failure behavior to plan for

  • event errors abort processing,
  • context cancellation aborts call loops,
  • unknown String commands are skipped by default dispatch,
  • Byte dispatch requires consistent opcode/autoshift registration.

Define integration-layer policy (strict fail / warn / collect metrics) for each case.

Clone this wiki locally