Skip to main content

Core Principle

The SDK never throws exceptions that could crash your application. Tracing is observability infrastructure - it should never break your production code.

Fail-Silent Behavior

All errors are caught internally. If traces can’t be sent, they’re dropped:
# This is safe even if Artanis is unreachable
trace = artanis.trace("operation")
trace.output(response)  # Never throws, even on network failure
No exceptions means zero risk to your production application.

What Happens on Error

When errors occur:
  1. Error is logged internally (if debug mode enabled)
  2. Trace is dropped silently
  3. Your application continues normally
  4. Optional error callback is called (if configured)

Custom Error Handling

To log errors for debugging:
import logging

logger = logging.getLogger(__name__)

artanis = Artanis(
    api_key="sk_...",
    on_error=lambda e: logger.warning(f"Artanis error: {e}")
)
on_error
callable
Callback function that receives errors. Use for logging or monitoring.

Network Failures

If the Artanis API is unreachable, traces are dropped silently to prevent memory leaks.
Traces are dropped rather than queued to prevent memory leaks in long-running applications with persistent network issues.

Error Scenarios

What happens: API returns 401 UnauthorizedSDK behavior: Drops traces, logs errorHow to fix: Check your API key in dashboard
What happens: Network request times outSDK behavior: Drops traces after retry, logs errorHow to fix: Check network connectivity
artanis = Artanis(
    api_key="sk_...",
    on_error=lambda e: alert_ops_team(e)
)
What happens: API returns 429 Too Many RequestsSDK behavior: Backs off, drops traces if persistentHow to fix: Reduce trace volume or upgrade plan
What happens: API returns 413 Payload Too LargeSDK behavior: Drops trace, logs errorHow to fix: Reduce trace data size
# Truncate large outputs
trace.output(response[:1000])  # First 1000 chars

Next Steps