Skip to main content

Overview

Lasso uses structured logging to provide comprehensive visibility into request routing, circuit breaker state transitions, and operational events. All logs follow a consistent JSON format for easy parsing and aggregation.

RequestContext Lifecycle

RequestContext is a stateless struct that threads through the entire request pipeline, capturing all routing decisions and timing data.

Context Structure

Context Creation

Context created at the start of each request:

Context Updates

Context updated at each pipeline stage:

Structured Log Schema

All completed requests emit a structured rpc.request.completed event.

Complete Event Example

Error Event Example

Field Descriptions

Routing section: Selection reasons:
  • "fastest_method_latency" - Lowest latency for this method (fastest strategy)
  • "static_priority" - Config priority (priority strategy)
  • "load_balanced_rotation" - Load balancing (load_balanced strategy)
  • "latency_weighted_selection" - Weighted random (latency_weighted strategy)
Timing section: Response section:

TelemetryLogger

TelemetryLogger bridges telemetry events to structured logs for production debugging.

Attached Handlers

Attaches handlers for:

Example Log Outputs

Failover event:
Circuit breaker opened:
Slow request:
All providers exhausted:

Configuration

Enable/disable specific log categories:
Disable all telemetry logging:

Telemetry Event Schemas

Circuit Breaker Events

All circuit breaker events use consistent metadata:
State transition reasons:

Failover Events

Request Timing Events

Privacy & Redaction

Error Message Truncation

Error messages limited to prevent logging unbounded responses:
Example:

No Secrets in Logs

  • Provider URLs: Not logged (only provider IDs)
  • API Keys: Never exposed
  • Client IPs: Not logged by default
  • Request parameters: Only presence flag (params_present: true/false)

Sampling

Reduce log volume in high-traffic scenarios:
Sampling behavior:
  • Random sampling: Each request independently sampled
  • Client metadata unaffected: Sampling only affects server logs
  • Rate: Float between 0.0 (none) and 1.0 (all)
Environment-specific sampling:

Configuration Reference

Complete Configuration

Log Parsing & Analysis

Extract Timing Data

Output:

Filter by Provider

Calculate Success Rate

Identify Slow Methods

Performance Characteristics

Overhead Breakdown

Memory Usage

  • RequestContext struct: ~200 bytes per request
  • Process dictionary storage: ~200 bytes (until response sent)
  • Peak usage: <1KB per in-flight request

Summary

Lasso’s logging system provides:
  • Structured JSON logs for easy parsing and aggregation
  • RequestContext lifecycle tracking all routing decisions
  • TelemetryLogger for operational events (failovers, circuit breakers)
  • Privacy-first with error truncation and no secrets in logs
  • Sampling support for high-traffic scenarios
  • Low overhead (<8ms per request, <1KB per in-flight request)
  • Telemetry integration for custom monitoring