The parameters to get traces
A paginated response containing traces and optional next cursor
// Get recent traces from a project
const result = await getTraces({
client,
project: { projectName: "my-project" },
limit: 50,
});
// Get traces in a time range with spans included
const result = await getTraces({
client,
project: { projectName: "my-project" },
startTime: new Date("2024-01-01"),
endTime: new Date("2024-01-02"),
includeSpans: true,
});
// Paginate through results
let cursor: string | undefined;
do {
const result = await getTraces({
client,
project: { projectName: "my-project" },
cursor,
limit: 100,
});
result.traces.forEach(trace => {
console.log(`Trace: ${trace.trace_id}`);
});
cursor = result.nextCursor || undefined;
} while (cursor);
Get traces from a project with filtering and sorting options.
This method fetches traces from a project with support for time range filtering, sorting, session filtering, and cursor-based pagination.