Skip to content

fix(node): flush queued events in short-lived processes (#843) - #848

Merged
unjica merged 1 commit into
developfrom
fix/843-node-flush
Oct 20, 2026
Merged

unjica merged 1 commit into
developfrom
fix/843-node-flush

Conversation

@unjica

@unjica unjica commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes #843.

  • @telemetry-tracker/core 1.5.2: new flush() (sends the queue, awaits in-flight batch requests, never rejects) and pendingEventCount(). Batching timer unchanged.
  • @telemetry-tracker/node 1.4.2: exports async flush(); registers a beforeExit handler that flushes only when events are queued (no exit loop), plus a best-effort exit handler that warns when events are still queued (e.g. after process.exit()).
  • Tests: unit tests for handlers and core flush; spawned-process tests against a local mock ingest: the issue's job.mjs delivers 2/2 with no sleep, await flush(); process.exit(0) delivers, long-running process still batches on the interval.
  • Docs: /docs/node short-lived jobs section, /docs/alerts heartbeat example and the missing-event alerts page use await flush(), each noting it requires Node SDK >= 1.4.2.
  • Not published to npm: core 1.5.2 and node 1.4.2 need publishing (core first).

@unjica
unjica merged commit 16fe723 into develop Oct 20, 2026
7 of 8 checks passed
@unjica unjica mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TT-023: Node SDK drops trackEvent() events when a short-lived process exits (no flush), breaking business heartbeats for jobs

1 participant