Skip to main content
Lynx is designed so telemetry failures do not stop your AI service by default.

Production defaults

OptionDefault
delivery.mode"BACKGROUND"
delivery.timeoutMs1000
delivery.flushOnRunEndfalse
delivery.flushIntervalMs3000
delivery.batchSize50
delivery.maxQueueSize1000
delivery.overflowStrategy"DROP_OLDEST"
circuitBreaker.enabledtrue
circuitBreaker.failureThreshold3
circuitBreaker.cooldownMs30000

Background delivery

In background mode, run() records events locally and returns without waiting for telemetry delivery. The SDK sends events from a timer, from explicit flush(), or from shutdown().
const lynx = new LynxTracer({
  clientId: "support-api",
  endpoint: "https://lynx.example.com",
  apiKey: process.env.LYNX_API_KEY,
  delivery: {
    mode: "BACKGROUND",
    timeoutMs: 1000,
    flushOnRunEnd: false,
  },
});

Blocking delivery

Use blocking mode only when the current process must make a send attempt during the request lifecycle.
const lynx = new LynxTracer({
  clientId: "worker",
  endpoint: "https://lynx.example.com",
  apiKey: process.env.LYNX_API_KEY,
  delivery: {
    mode: "BLOCKING",
    flushOnRunEnd: true,
    timeoutMs: 1500,
  },
});

Flush and shutdown

await lynx.flush();
Use shutdown() before the process exits.
await lynx.shutdown({ timeoutMs: 1000 });

Local status

const status = lynx.getStatus();

console.log(status.queueSize);
console.log(status.circuitState);
console.log(status.droppedEvents);

If the Lynx server is down

The SDK catches network, timeout, and non-2xx response errors. Failed batches move to an in-memory retry queue. After repeated failures, the circuit breaker opens and pauses delivery attempts until the cooldown passes. If the queue reaches maxQueueSize, the SDK drops events according to overflowStrategy.