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 { init, auralog, getTraceId } from "auralog-sdk";
init({ apiKey: "aura_..." });
auralog.info("request received"); // trace ID auto-attached
auralog.info("processing complete"); // same trace ID

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

import { getTraceId } from "auralog-sdk";
const response = await fetch("https://api.example.com/process", {
headers: {
"X-Trace-Id": getTraceId(),
},
});
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 ID

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",
});
init({
apiKey: "aura_...",
traceId: "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