Skip to content

feat: bound a flood of beacon events in the rollup - #109

Merged
hughgrigg merged 1 commit into
mainfrom
claude/beacon-flood-filter-104
Aug 29, 2026
Merged

feat: bound a flood of beacon events in the rollup#109
hughgrigg merged 1 commit into
mainfrom
claude/beacon-flood-filter-104

Conversation

@hughgrigg

Copy link
Copy Markdown
Contributor

The beacon's collection path is unauthenticated and idempotent by design, so anybody can send its URL a million times and have every one of them counted under a page value naming a page nobody opened. Stopping that at the edge takes a request counter and the only place at the edge that holds one is AWS WAF, at $6.00 a month before a request reaches it, so the judgement goes in the query instead, beside the crawler filter every question already applies. A beaconEvents rollup counts what the beacon reported by page and by event name, and counts one visitor's identical events no more than 60 times an hour, which is one a minute from one person on one page of one event name. The cap is keyed on the hour of the row's own timestamp rather than on the window being computed, so an hourly and a daily summary apply the same cap and the 24 hours of a day add up to it. A visitor here is the address and user agent CloudFront logged, being the pair a visitor count is hashed from, and neither value leaves the query, so a deployment delivering no address is refused at synthesis through a new identifiesViewers flag on Rollup. The question is opt-in rather than a sixth default question, because a site with no beacon would otherwise pay 50 Athena queries a day for an empty answer, about 8 cents a month against the $0.084 #9 measured for the whole log store, and rainlytics saved-query beacon-events is the command that already exists for a question deployed from somewhere else. The cases run the SQL through Yulin's query engine over delivered log objects rather than asserting on its text, and Yulin has no least (raised as KensioSoftware/yulin#1141), so the cap is written as the CASE that says the same thing and both engines run.

Resolves #104

  • Conventional commit message, used as the title

  • Conventional branch name, like feat/concise-description

  • Full check with pnpm run check passed

  • Rebased off latest main

  • User-facing behaviour is documented in docs/

See https://www.conventionalcommits.org/en/v1.0.0/

The collection path is unauthenticated and idempotent by design, so anybody
can send its URL a million times and have every one of them counted under a
page value naming a page nobody opened. Stopping that at the edge takes a
request counter, and the only place at the edge that holds one is AWS WAF at
$6.00 a month before a request reaches it.

So the judgement goes in the query, beside the crawler filter every question
already applies. A `beaconEvents` rollup counts what the beacon reported, by
page and by event name, and counts one visitor's identical events no more
than 60 times an hour. That is one a minute from one person, on one page, of
one event name. A reader moving around a site is capped on each page
separately, and a client sending the same URL a million times contributes 60.

#104 lists the two candidates that lost. Dropping
events whose page never appears as a pageview drops exactly the single-page
route changes layer 2 exists to collect. A cap per path has no number that
both bounds a flood and spares a popular page.

The cap is keyed on the hour of the row's own timestamp rather than on the
window being computed. One query text serves both cadences, so an hourly and
a daily summary apply the same cap and the 24 hours of a day add up to it.

A visitor here is the address and user agent CloudFront logged, being the
pair a visitor count is hashed from, and neither value leaves the query. A
deployment delivering no address is refused at synthesis through the new
`identifiesViewers` flag on `Rollup`, since a beacon rollup without the cap
would report a flood of a million as a million.

The question is opt-in rather than a sixth default. A site with no beacon
would otherwise pay 50 Athena queries a day for an empty answer, about 8
cents a month against the $0.084 #9 measured for the whole log store. A site
running the beacon passes it to `RollupQueries` and `RollupSummaries` and
reads it with `rainlytics saved-query beacon-events`.

The cases run the SQL through Yulin's query engine over delivered objects
rather than asserting on its text. Yulin has no `least`, raised as
KensioSoftware/yulin#1141, so the cap is written as the `CASE` that says the
same thing and both engines run.
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 8 minutes.

View limit details

Limit details: You’ve used the included review currently available. Your 90 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 04ea43b4-0fb6-48f2-b65c-c30fb26c6854

📥 Commits

Reviewing files that changed from the base of the PR and between 5f09437 and c5e42b1.

📒 Files selected for processing (10)
  • docs/README.md
  • docs/abuse/README.md
  • docs/beacon-events/README.md
  • docs/rollups/README.md
  • src/beacon-rollup.test.ts
  • src/beacon-rollup.ts
  • src/cdk/computed-questions.ts
  • src/cdk/summary-configuration.test.ts
  • src/index.ts
  • src/rollups.ts

Comment @coderabbitai help to get the list of available commands.

@hughgrigg
hughgrigg merged commit d20ccbd into main Aug 29, 2026
8 checks passed
@hughgrigg
hughgrigg deleted the claude/beacon-flood-filter-104 branch August 29, 2026 16:18
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.

Filter spammed beacon events in the rollup, since the edge cannot pay for it

1 participant