Skip to main content

Module record

Module record 

Source
Expand description

Counting traffic: every request (fed from the access-log path, so all protocols and whether or not lines are written) lands in hourly counts per host and group, daily unique visitors, and daily top lists.

Bounded by construction: MAX_HOSTS hosts (more go to other), hourly buckets for retention_days, top lists of TOP entries a day (the rest added to (other)), MAX_PENDING undecided browsers per shard, a classification cache of MAX_CACHE per shard. Unique visitors are counted with hash(secret, day, host, ip, user-agent) — the secret is made at start and never stored, nor are the hashes — so nobody can be followed from one day to the next and no IP or User-Agent is kept.

A browser isn’t a person until it loads a stylesheet, script or font as a browser rendering the page does: its requests wait in a pending record and are counted as a person’s then, or as “browser, no assets” (a bot) after UNDECIDED without one — or at once after 32 requests without one.

Constants§

MAX_CACHE
Classifications cached per shard.
MAX_HOSTS
Hosts counted separately; others are other.
MAX_PENDING
Browsers awaiting their first asset, per shard.
TOP
Entries a daily top list keeps.
TOP_SAVED
Entries of each top list kept on disk and reported.
UNDECIDED
A browser that loads no asset this long after its last request isn’t a person.

Functions§

enable
Start counting (the binary does this when the admin API is on).
enabled
Whether requests are being counted.
now
Seconds since the epoch, as the counts use.