Skip to content

Distributed Tracing

Auralog automatically generates a trace ID for each SDK session, allowing you to correlate logs across multiple services and see the full request flow.

When you call init(), the SDK generates a unique trace ID. Every log sent during that session includes this trace ID. If your app calls multiple backend services, you can propagate the trace ID so all services log under the same trace.

By default, every log includes a trace ID with no extra configuration:

import auralog as al
al.init(api_key="aura_...")
al.auralog.info("request received") # trace ID auto-attached
al.auralog.info("processing complete") # same trace ID

To correlate logs across services, pass the trace ID in HTTP headers:

import auralog as al
response = requests.post(
"https://api.example.com/process",
headers={"X-Trace-Id": al.get_trace_id()},
)
import auralog as al
from flask import request
al.init(api_key="aura_...")
@app.before_request
def propagate_trace():
incoming = request.headers.get("X-Trace-Id")
if incoming:
al.set_trace_id(incoming)
al.auralog.info("processing request") # uses the propagated trace ID
import auralog as al
from fastapi import Request
al.init(api_key="aura_...")
@app.middleware("http")
async def propagate_trace(request: Request, call_next):
incoming = request.headers.get("X-Trace-Id")
if incoming:
al.set_trace_id(incoming)
return await call_next(request)

You can override the trace ID for individual logs by including traceId in metadata:

al.auralog.info("external request", metadata={
"traceId": "custom-trace-abc123",
"endpoint": "/api/users",
})
al.init(
api_key="aura_...",
trace_id="my-custom-trace-id",
)

In the Log Viewer, logs with a trace ID show a trace icon. Click it to filter the view to all logs sharing that trace ID, displayed in chronological order. You can also search by trace ID:

trace:abc123