feat: tracker-only device stats with auth-failure tracking#16
Merged
Conversation
Drop reads of device.lastSeen, device.version, and ConnectionRegistry from the stats path; build 1h/24h windows from DeviceClientIdentityTracker seenAt timestamps. Non-octi clients are bucketed as <unknown>. Add auth-failure stream with stable reason tags (missing-device-id, missing-credentials, unknown-device, bad-credentials). Storage is a synchronized ArrayDeque capped at 10k events; snapshots prune anything older than 24h. Reporter logs a per-window reason x top-5 UA matrix. Record client identity immediately after auth succeeds, before the per-account rate-limit gate, so legitimately over-limit devices stay visible in the report. Persisted device.lastSeen still updates only after the gate accepts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeviceClientIdentityTrackerthe sole source for the 1h/24h device-activity report. The reporter no longer readsdevice.lastSeen,device.version, orConnectionRegistry— it builds windows from trackerseenAtinstead. Post-restart the report shows what this server instance has actually observed.<unknown>). Record client identity immediately after auth succeeds, before the per-account rate-limit gate, so legitimately over-limit devices stay visible. Persisteddevice.lastSeen/ IP-tracker churn is still gated behind the rate limiter.AuthResult.FailurefromverifyCallerandWsRoutelands in a capped (10k), 24h-windowed deque, tagged with stable reasons (missing-device-id,missing-credentials,unknown-device,bad-credentials). Reporter logs a per-window reason × top-5 UA matrix.Test plan
DeviceActivityReporterTestfor the tracker-driven signature, including auth-failure section formatting.AuthenticateDeviceTesttag assertions plus parse-collapse cases (blank/malformed device-id, non-Basic auth, invalid base64, payload without colon, non-UUID account)../gradlew checkgreen.