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.
How It Works
Section titled “How It Works”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.
Automatic Tracing
Section titled “Automatic Tracing”By default, every log includes a trace ID with no extra configuration:
import { init, auralog, getTraceId } from "auralog-sdk";
init({ apiKey: "aura_..." });
auralog.info("request received"); // trace ID auto-attachedauralog.info("processing complete"); // same trace IDPropagating Across Services
Section titled “Propagating Across Services”To correlate logs across services, pass the trace ID in HTTP headers:
Sending service
Section titled “Sending service”import { getTraceId } from "auralog-sdk";
const response = await fetch("https://api.example.com/process", { headers: { "X-Trace-Id": getTraceId(), },});Receiving service
Section titled “Receiving service”import { init, auralog, setTraceId } from "auralog-sdk";
init({ apiKey: "aura_..." });
app.use((req, res, next) => { const incomingTraceId = req.headers["x-trace-id"]; if (incomingTraceId) { setTraceId(incomingTraceId); } next();});
auralog.info("processing request"); // uses the propagated trace IDPer-Log Trace ID Override
Section titled “Per-Log Trace ID Override”You can override the trace ID for individual logs by including traceId in metadata:
auralog.info("external request", { traceId: "custom-trace-abc123", endpoint: "/api/users",});Setting a Custom Trace ID at Init
Section titled “Setting a Custom Trace ID at Init”init({ apiKey: "aura_...", traceId: "my-custom-trace-id",});Viewing Traces in the Dashboard
Section titled “Viewing Traces in the Dashboard”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