Detect missing serverless telemetry by reconciling expected event identifiers against collector acknowledgments and durable records after the request finishes. A successful user response is not evidence that an unawaited telemetry operation completed.
Define three separate completion points
In this example the application responds at time 100, a telemetry send begins at 90, and a collector acknowledgment arrives at 130. A send-start timestamp cannot establish delivery. Even an acknowledgment may describe queue acceptance rather than durable processing; identify the meaning of the endpoint’s response before counting the event.
Reproduce the lifecycle boundary
- Use a synthetic request and assign its telemetry event a stable identifier before sending.
- Record response completion, send start, acknowledgment, and final searchable record as separate milestones.
- Compare an awaited send with the runtime’s documented background execution mechanism. Do not assume that keeping a promise reference extends execution.
- Exercise a timeout and abrupt completion; reconcile missing IDs after the documented processing window.
Use the mechanism your runtime supports
The repository uses the legacy Netlify handler style with @netlify/functions 2.x. Consult the applicable background-function convention and the project configuration rather than pasting a newer handler API into an older integration. Netlify background execution is a distinct invocation path; it is not permission to leave arbitrary request work untracked.
Interpret the example conservatively
The supplied event ledger identifies an attempted send that has no durable record. It intentionally does not simulate a real serverless shutdown. Validate lifecycle behavior on your actual runtime, including error handling and retry limits, before changing the production integration.
Run the worked example
Save the synthetic Node.js example and run node detect-missing-serverless-llm-events.mjs with Node.js 22 or newer. The assertions check the illustrated records and calculations; they do not test a deployed provider, SDK, or access control. No credentials or network connection are needed.
// Synthetic teaching fixture. No credentials, network calls, or production verification.
import assert from 'node:assert/strict';
const expected = ['event-1', 'event-2'];
const attempts = [
{ id: 'event-1', sendStartedAt: 90, responseEndedAt: 100 },
{ id: 'event-2', sendStartedAt: 91, responseEndedAt: 100 },
];
const durable = new Set(['event-1']);
const missing = expected.filter(id => !durable.has(id));
assert.deepEqual(missing, ['event-2']);
assert.equal(attempts.some(a => a.id === 'event-2'), true);
assert.equal(durable.has('event-2'), false);
console.log('event-2 was attempted but has no durable record.');
References and further reading
Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.