SideSeat Class
The SideSeat class is the main entry point for the Python SDK. It manages OpenTelemetry setup, framework instrumentation, and exporters.
Class Definition
Section titled “Class Definition”class SideSeat: def __init__( self, endpoint: str | None = None, project_id: str | None = None, api_key: str | None = None, framework: str | None = None, auto_instrument: bool = True, service_name: str | None = None, service_version: str | None = None, enable_traces: bool = True, enable_metrics: bool = True, enable_logs: bool = False, capture_content: bool = True, encode_binary: bool = True, disabled: bool = False, debug: bool = False, ) -> None: ...Properties
Section titled “Properties”config
Section titled “config”Immutable configuration object.
client = SideSeat()print(client.config.endpoint)print(client.config.project_id)telemetry
Section titled “telemetry”Access to the underlying telemetry client for debug exporters.
client = SideSeat()client.telemetry.setup_console_exporter()client.telemetry.setup_file_exporter("traces.jsonl")tracer_provider
Section titled “tracer_provider”The OpenTelemetry TracerProvider instance managing trace collection.
client = SideSeat()provider = client.tracer_provider
# Force flush all pending spansprovider.force_flush()is_disabled
Section titled “is_disabled”Whether telemetry is disabled.
client = SideSeat()if client.is_disabled: print("Telemetry is disabled")Methods
Section titled “Methods”span(name)
Section titled “span(name)”Create a custom span for tracing.
Parameters:
name(str): Span name
Returns: ContextManager[Span]
client = SideSeat()
with client.span("my-operation") as span: span.set_attribute("user_id", "123") result = process_request()# Errors are automatically recorded with stack traceget_tracer(name)
Section titled “get_tracer(name)”Get an OpenTelemetry tracer.
Parameters:
name(str): Tracer name
Returns: Tracer
client = SideSeat()tracer = client.get_tracer("my-module")
with tracer.start_as_current_span("operation"): # ... work ... passforce_flush(timeout_millis)
Section titled “force_flush(timeout_millis)”Export pending spans immediately.
Parameters:
timeout_millis(int): Timeout in milliseconds. Default:30000
Returns: bool
client = SideSeat()# ... do work ...success = client.force_flush(timeout_millis=5000)validate_connection(timeout)
Section titled “validate_connection(timeout)”Test server connectivity.
Parameters:
timeout(float): Timeout in seconds. Default:5.0
Returns: bool
client = SideSeat()if client.validate_connection(): print("Server is reachable")shutdown(timeout_millis)
Section titled “shutdown(timeout_millis)”Gracefully shutdown all exporters, flushing pending spans.
Parameters:
timeout_millis(int): Timeout in milliseconds. Default:30000
Returns: None
client = SideSeat()# ... do work ...client.shutdown()Context Manager
Section titled “Context Manager”Use the context manager for automatic shutdown:
with SideSeat() as client: # Your code runs with tracing enabled run_my_agent()# Traces flushed and shutdown automaticallyUsage Patterns
Section titled “Usage Patterns”Basic Usage
Section titled “Basic Usage”from sideseat import SideSeat
client = SideSeat()
# Your code runs with tracing enabled# ...
# Optional: explicit shutdownclient.shutdown()With Framework Selection
Section titled “With Framework Selection”from sideseat import SideSeat, Frameworks
client = SideSeat(framework=Frameworks.Strands)With Custom Configuration
Section titled “With Custom Configuration”client = SideSeat( endpoint="http://localhost:5388", project_id="my-project", service_name="my-agent", service_version="1.0.0",)With Debug Exporters
Section titled “With Debug Exporters”client = SideSeat()client.telemetry.setup_console_exporter() # Print spansclient.telemetry.setup_file_exporter("traces.jsonl") # Write to fileDisabled Mode
Section titled “Disabled Mode”# For testing/CIclient = SideSeat(disabled=True)# Or: SIDESEAT_DISABLED=trueThread Safety
Section titled “Thread Safety”The SideSeat class is thread-safe:
- Multiple threads can create spans concurrently
shutdown()can be called from any thread- Exporters use internal locking
import threading
client = SideSeat()
def worker(): with client.span("worker"): # ... work ... pass
threads = [threading.Thread(target=worker) for _ in range(10)]for t in threads: t.start()for t in threads: t.join()
client.shutdown()Next Steps
Section titled “Next Steps”- Configuration — all configuration options
- Exporters — debug exporters for development