Observability module for PocketFlow
Provides structured logging, metrics, and tracing capabilities.
Vars
globalObserver = Observer(metrics: @[], spans: @[], currentSpan: nil)
Procs
proc getDurationMs(span: Span): float {....raises: [], tags: [], forbids: [].}
- Gets the duration of a span in milliseconds
proc getMetricsSummary(): JsonNode {....raises: [KeyError], tags: [], forbids: [].}
- Returns a JSON summary of all recorded metrics
proc logStructured(level: LogLevel; message: string; fields: openArray[(string, string)] = []) {....raises: [], tags: [], forbids: [].}
- Logs a structured message with additional fields
proc recordMetric(name: string; value: float; tags: openArray[(string, string)] = []) {....raises: [], tags: [TimeEffect], forbids: [].}
- Records a metric measurement