Observability
Observability
Section titled “Observability”Configure logging, metrics, and distributed tracing for Wippy applications.
Overview
Section titled “Overview”Wippy provides three observability pillars configured at boot time:
| Pillar | Backend | Configuration |
|---|---|---|
| Logging | Zap (JSON structured) | logger and logmanager |
| Metrics | Prometheus | prometheus |
| Tracing | OpenTelemetry | otel |
Logger Configuration
Section titled “Logger Configuration”Basic Logger
Section titled “Basic Logger”logger: encoding: json # json or consoleLevel and output are controlled by CLI flags (-v, -c, -s) — only encoding is read from yaml.
Log Manager
Section titled “Log Manager”The log manager controls log propagation and event streaming:
logmanager: propagate_downstream: true # Propagate to child components stream_to_events: false # Forward logs to event bus min_level: -1 # -1=debug (default), 0=info, 1=warn, 2=errorWhen stream_to_events is enabled, log entries become events that processes can subscribe to via the event bus.
Automatic Context
Section titled “Automatic Context”Logs emitted from Lua via the logger module automatically include:
pid- Current process PIDlocation- Entry ID and caller line (e.g.,app.api:handler:45)
Prometheus Metrics
Section titled “Prometheus Metrics”prometheus: enabled: true address: "localhost:9090"Metrics are exposed at /metrics on the configured address.
Scrape Configuration
Section titled “Scrape Configuration”scrape_configs: - job_name: 'wippy' static_configs: - targets: ['localhost:9090'] scrape_interval: 15sFor the Lua metrics API, see Metrics Module.
OpenTelemetry
Section titled “OpenTelemetry”OTEL provides distributed tracing and optional metrics export.
Basic Configuration
Section titled “Basic Configuration”otel: enabled: true endpoint: "localhost:4318" protocol: http/protobuf # grpc or http/protobuf service_name: my-app service_version: "1.0.0" insecure: false # Allow non-TLS connections sample_rate: 1.0 # 0.0 to 1.0 traces_enabled: true metrics_enabled: false propagators: - tracecontext - baggageTrace Sources
Section titled “Trace Sources”Enable tracing for specific components:
otel: enabled: true endpoint: "localhost:4318" service_name: my-app
# HTTP request tracing http: enabled: true extract_headers: true # Read incoming trace context inject_headers: true # Write outgoing trace context
# Process lifecycle tracing process: enabled: true trace_lifecycle: true # Trace spawn/exit events
# Queue message tracing queue: enabled: true
# Function call tracing interceptor: enabled: true order: 100 # Interceptor execution orderTemporal Workflows
Section titled “Temporal Workflows”Enable tracing for Temporal workflows:
otel: enabled: true endpoint: "localhost:4318" service_name: my-app
temporal: enabled: trueWhen enabled, the Temporal SDK’s tracing interceptor is registered for both client and worker operations.
Traced operations:
- Workflow starts and completions
- Activity executions
- Child workflow calls
- Signal and query handling
What Gets Traced
Section titled “What Gets Traced”| Component | Span Name | Attributes |
|---|---|---|
| HTTP requests | {METHOD} {route} | http.method, http.url, http.host |
| Function calls | Function ID | process.pid, frame.id |
| Process lifecycle | {source}.started/terminated | process.pid |
| Queue messages | Message topic | Trace context in headers |
| Temporal workflows | Workflow/Activity name | workflow.id, run.id |
Context Propagation
Section titled “Context Propagation”Trace context propagates automatically:
- HTTP → Function: W3C Trace Context headers
- Function → Function: Frame context inheritance
- Process → Process: Spawn context
- Queue publish → consume: Message headers
Environment Variables
Section titled “Environment Variables”OTEL can be configured via environment:
| Variable | Description |
|---|---|
OTEL_SDK_DISABLED | Set to true to disable OTEL |
OTEL_EXPORTER_OTLP_ENDPOINT | Collector endpoint |
OTEL_EXPORTER_OTLP_PROTOCOL | grpc or http/protobuf |
OTEL_SERVICE_NAME | Service name |
OTEL_SERVICE_VERSION | Service version |
OTEL_TRACES_SAMPLER_ARG | Sample rate (0.0-1.0) |
OTEL_PROPAGATORS | Propagator list |
Runtime Statistics
Section titled “Runtime Statistics”The system module provides internal runtime statistics:
local system = require("system")
-- Memory statisticslocal mem = system.memory.stats()-- mem.alloc, mem.heap_alloc, mem.heap_objects, etc.
-- Goroutine countlocal count = system.runtime.goroutines()
-- Supervisor stateslocal states = system.supervisor.states()See Also
Section titled “See Also”- Logger Module - Lua logging API
- Metrics Module - Lua metrics API
- System Module - Runtime statistics