Foredeck

Counters (metrics)

Counter metric submissions, batching, and aggregation semantics

client.count(name) records one submission of value 1 at call time; client.count(name, n) records value n. Submissions are batched in-memory and flushed asynchronously to POST {eventsUrl}/counters on the same dual trigger (5s interval OR 50 queued) and authenticated transport as exposures, and automatically carry the configured service/env and default tags.

Aggregation semantics (sum = total of submitted values, count = number of submissions, avg = sum รท submissions) are defined in PRD-15. Values are integers on the wire (the ingest contract is count: int); fractional values are rounded client-side. Emission never throws; delivery failures are retried with backoff (4xx rejections are dropped immediately), and in browsers the queue is beaconed on pagehide/tab-hide, same as exposures.

foredeck.count('checkout.completed');     // one submission, value 1
foredeck.count('checkout.items', 3);      // one submission, value 3