Skip to content

Python SDK Exporters

The SideSeat Python SDK automatically exports traces to the SideSeat server via OTLP. For debugging, you can add console or file exporters.

By default, SideSeat() exports traces to the OTLP endpoint:

from sideseat import SideSeat
client = SideSeat() # Exports to http://127.0.0.1:5388 by default

Access debug exporters via the telemetry property:

client = SideSeat()
client.telemetry.setup_console_exporter() # Print to stdout
client.telemetry.setup_file_exporter("traces.jsonl") # Write to file

Prints spans to stdout. Useful for debugging during development.

client = SideSeat()
client.telemetry.setup_console_exporter()
{
"name": "llm.completion",
"context": {
"trace_id": "0x1234567890abcdef...",
"span_id": "0xabcdef1234567890"
},
"start_time": "2024-01-15T10:30:00.000000Z",
"end_time": "2024-01-15T10:30:01.500000Z",
"attributes": {
"gen_ai.system": "openai",
"gen_ai.request.model": "gpt-5-mini",
"gen_ai.usage.input_tokens": 150,
"gen_ai.usage.output_tokens": 200
}
}

Writes spans to a JSONL (JSON Lines) file. Each line is a complete JSON object.

client = SideSeat()
client.telemetry.setup_file_exporter("traces.jsonl")
# Append to existing file
client.telemetry.setup_file_exporter("traces.jsonl", mode="a")

Each run adds new spans to the file.

# Overwrite on each run
client.telemetry.setup_file_exporter("traces.jsonl", mode="w")

Clears the file at startup.

import os
from pathlib import Path
# Absolute path
client.telemetry.setup_file_exporter("/var/log/myapp/traces.jsonl")
# Relative to home
home = Path.home()
client.telemetry.setup_file_exporter(str(home / ".myapp" / "traces.jsonl"))
# Date-based
from datetime import datetime
filename = f"traces-{datetime.now().strftime('%Y-%m-%d')}.jsonl"
client.telemetry.setup_file_exporter(filename)
{"name":"llm.completion","trace_id":"abc123...","span_id":"def456...","parent_span_id":null,"start_time":"2024-01-15T10:30:00.000000Z","end_time":"2024-01-15T10:30:01.500000Z","attributes":{"gen_ai.system":"openai"}}
{"name":"tool.call","trace_id":"abc123...","span_id":"ghi789...","parent_span_id":"def456...","start_time":"2024-01-15T10:30:01.000000Z","end_time":"2024-01-15T10:30:01.200000Z","attributes":{"tool.name":"calculator"}}

Use multiple exporters for different use cases:

import os
from sideseat import SideSeat
client = SideSeat()
# Backup: Local file
client.telemetry.setup_file_exporter("traces-backup.jsonl")
# Debug: Console output (development only)
if os.getenv("DEBUG"):
client.telemetry.setup_console_exporter()

For custom OTLP configuration, use environment variables:

VariableDescriptionDefault
OTEL_EXPORTER_OTLP_ENDPOINTBase endpoint URL(from SIDESEAT_ENDPOINT)
OTEL_EXPORTER_OTLP_HEADERSHeaders (key=value,key2=value2)(none)
OTEL_EXPORTER_OTLP_TIMEOUTTimeout in milliseconds10000
OTEL_EXPORTER_OTLP_COMPRESSIONCompression algorithm(none)
ExporterUse CasePersistenceLatency
OTLP (default)Production, real-time monitoringRemote serverLow
ConsoleDevelopment, debuggingNoneInstant
FileBackup, offline analysisLocal fileLow
  1. Production: Default OTLP only (minimal overhead)
  2. Development: Add console for visibility
  3. CI/CD: Add file exporter for artifact collection
import os
from sideseat import SideSeat
# Production setup
client = SideSeat()
# Development setup
if os.getenv("DEBUG"):
client.telemetry.setup_console_exporter()
# CI/CD setup
if os.getenv("CI"):
client.telemetry.setup_file_exporter("traces.jsonl")