Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Every option you can pass to the TruLayer constructor.
apiKey
string
tl_...
projectName
projectId
environment
"production"
endpoint
https://api.trulayer.ai
batchSize
number
50
flushInterval
2000
timeout
5000
sampleRate
number | () => boolean
1.0
redact
(value: unknown) => unknown
undefined
relayUrl
debug
boolean
false
import { TruLayer } from "@trulayer/sdk"; export const tl = new TruLayer({ apiKey: process.env.TRULAYER_API_KEY!, projectName: "prod", environment: "production", batchSize: 50, flushInterval: 2000, redact: (value) => { if (typeof value !== "string") return value; return value .replace(/\b[\w.+-]+@[\w.-]+\.\w{2,}\b/gi, "[email]") .replace(/\b\d{13,16}\b/g, "[cc]"); }, });
const tl = new TruLayer({ apiKey: "tl_local", projectName: "test", debug: true, });
const tl = new TruLayer({ apiKey: "tl_local", projectName: "test", endpoint: "http://localhost:4010", });
new TruLayer({ ..., sampleRate: 0.1 }); // 10%
new TruLayer({ ..., sampleRate: () => Math.random() < 0.1, });
await tl.flush(); // ship buffered traces, resolve when done await tl.shutdown(); // flush + stop background work
flush()
shutdown()
SIGTERM