Skip to content

feat(sw): manifest-driven telemetry endpoints with installationTime sampling - #98

Open
a-d-j-i wants to merge 1 commit into
refactor/telemetry-batches-storefrom
feat/manifest-telemetry-config
Open

a-d-j-i wants to merge 1 commit into
refactor/telemetry-batches-storefrom
feat/manifest-telemetry-config

Conversation

@a-d-j-i

@a-d-j-i a-d-j-i commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Lays the config/manifest/context plumbing that the upcoming security-processor + telemetry-executor stack consumes. Nothing here reads the new values yet — this is purely infrastructure.

Manifest schema grows telemetry: {eventsEndpoint, logsEndpoint, logsFilter}; logsFilter = N means 1-in-N installs sampled in via installationTime % logsFilter === 0, which is stable per install and can be widened/narrowed in a new manifest release without client changes. Missing/invalid values collapse to DEFAULT_LOGS_FILTER=1000.

Resolution chain per channel is manifest → config → null. Config carries bootstrap fallbacks via ?eventsEndpoint= / ?logsEndpoint= on the SW URL (populated from data-events-endpoint / data-logs-endpoint on the client script tag). resolveManifest() returns
{appVersion, telemetryEndpoints: {events, logs}} on top of the existing {mode, prepareRequest, verifyResponse} — the executor reads this per send cycle so a manifest rotation flips URLs/sampling without SW restart.

Also:

  • SYNC_TAG_REPORT_EVENTS = 'dappfence-report-events' constant; lifecycle uses it instead of a hardcoded string
  • safely(fn, onError) helper for SW handlers that must not reject waitUntil
  • swContext.registerSync(tag) wraps Background Sync registration, with a clear error when the API is unavailable (Safari / older Firefox)
  • test-app build.js passes manifest.telemetry through to the signed payload
  • test-app ships a telemetry-manifest.json variant pointing at /capture/events so e2e can observe POST bodies via the existing capture sink

@a-d-j-i
a-d-j-i added this pull request to stack #95 October 29, 2026 16:23
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch from 4858978 to dda8431 Compare October 30, 2026 15:28
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch 4 times, most recently from 2614775 to 4e56f70 Compare November 3, 2026 14:46
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch 2 times, most recently from 2729c54 to 8573978 Compare November 5, 2026 18:08
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch from 8573978 to 4de0db0 Compare November 16, 2026 15:10
@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dappfence-templates canceled.

Name Link
🔨 Latest commit 53bbcea
🔍 Latest deploy log https://app.netlify.com/projects/dappfence-templates/deploys/6b13001ceb2865b4aab2ea26

@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch 2 times, most recently from 24256b8 to 883cc93 Compare November 16, 2026 17:06
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch 2 times, most recently from 7a0250f to b46cd2b Compare November 17, 2026 13:20
@a-d-j-i
a-d-j-i removed this pull request from stack #95 November 17, 2026 14:27
@a-d-j-i
a-d-j-i added this pull request to stack #112 November 17, 2026 14:27
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch from b46cd2b to 97e90e9 Compare November 27, 2026 16:35
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch from 97e90e9 to bff9409 Compare December 4, 2026 17:23
…ampling

Lays the config/manifest/context plumbing that the upcoming
security-processor + telemetry-executor stack consumes. Nothing here reads
the new values yet — this is purely infrastructure.

Manifest schema grows `telemetry: {eventsEndpoint, logsEndpoint, logsFilter}`;
`logsFilter = N` means 1-in-N installs sampled in via
`installationTime % logsFilter === 0`, which is stable per install and
can be widened/narrowed in a new manifest release without client changes.
Missing/invalid values collapse to DEFAULT_LOGS_FILTER=1000.

Resolution chain per channel is manifest → config → null. Config carries
bootstrap fallbacks via `?eventsEndpoint=` / `?logsEndpoint=` on the SW URL
(populated from `data-events-endpoint` / `data-logs-endpoint` on the client
script tag). `resolveManifest()` returns
`{appVersion, telemetryEndpoints: {events, logs}}` on top of the existing
`{mode, prepareRequest, verifyResponse}` — the executor reads this per
send cycle so a manifest rotation flips URLs/sampling without SW restart.

Also:
- `SYNC_TAG_REPORT_EVENTS = 'dappfence-report-events'` constant; lifecycle
  uses it instead of a hardcoded string
- `safely(fn, onError)` helper for SW handlers that must not reject waitUntil
- `swContext.registerSync(tag)` wraps Background Sync registration, with a
  clear error when the API is unavailable (Safari / older Firefox)
- test-app `build.js` passes `manifest.telemetry` through to the signed payload
- test-app ships a `telemetry-manifest.json` variant pointing at `/capture/events`
  so e2e can observe POST bodies via the existing capture sink
@a-d-j-i
a-d-j-i force-pushed the feat/manifest-telemetry-config branch from bff9409 to 53bbcea Compare December 4, 2026 18:02

This branch has not been deployed

No deployments
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.

1 participant