# Telemetry Rate Limiting

Phase 72.5.1.8 adds `@v2/telemetry-rate-limiting`, the production volume guard
for telemetry batches. It filters `TelemetryEventBatch` records before
high-frequency events reach downstream analytics.

## Session Sampling

`assignTelemetrySessionSampleRate` gives each session a deterministic sample
rate between 1 and 100 percent using the salt
`v2-telemetry-session-sampling-v1`. The assignment is stable for the session,
and individual events are sampled with a deterministic hash of session ID,
topic, event ID, and salt. Each session receives a deterministic sample rate
between 1 and 100 percent.

## Rate Limits

`InMemoryTelemetryRateLimiter` implements per-session/topic token buckets. The
default policy allows 300 events per minute with a 60-event burst. Topic
overrides reduce volume for high-frequency events:

| Topic                            | Max/min | Burst | Sample |
| -------------------------------- | ------: | ----: | -----: |
| `v2.player.ui.interacted`        |     120 |    30 |    10% |
| `v2.match.level.loaded`          |      60 |    20 |   100% |
| `v2.match.player.death`          |     180 |    60 |   100% |
| `v2.player.achievement.unlocked` |      60 |    20 |    50% |

`filterTelemetryBatchByRateLimitAndSampling` returns an accepted batch plus
decision records for sampled-out and rate-limited events so producers can
observe production volume controls.

## Critical Bypass

Critical override topics are always sampled at 100 percent and bypass rate
limits: critical override topics are never sampled down or rate limited.

- `v2.match.crash.reported`
- `v2.player.cheat-detection.detected`
- `v2.player.error.reported`

Targeted verification:

```bash
pnpm --filter @v2/telemetry-rate-limiting run typecheck
pnpm --filter @v2/telemetry-rate-limiting run test
python V2/ue/Tools/check-v2-telemetry-rate-limiting.py
```
