Repository navigation
feat(metrics): accept a time range on dashboard metrics and anomalies - #364
Merged
Merged
Conversation
The two internal endpoints that fed the operator screens without a range now take from and to, so a console can offer one range control. Dashboard metrics keeps its 24 hour fields and adds window-neutral ones; anomalies pages and reports a real total. Closes #132.
Bccorb
force-pushed
the
feat/ranged-internal-metrics
branch
from
October 7, 2026 02:53
7342db5 to
1bbcb4f
Compare
Bccorb
marked this pull request as ready for review
October 7, 2026 02:53
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.
Closes #132.
Depends on
@seamless-auth/types0.28.0 (fells-code/seamless-auth-types#91), now published and pinned here. Rebased onto main after #363 and #365.What changed
GET /internal/metrics/dashboardtakesfrom/to(DashboardMetricsQuerySchema, the same range rules as/internal/auth-events/*), defaulting to the last 24 hours.*24hfields keep meaning the last 24 hours whatever window is asked for. That was the agreed answer to the naming question.newUsers,loginSuccess,loginFailed,successRate,otpUsage,passkeyUsagecover the requested window, andwindowsays which one.GET /internal/security/anomaliestakesfrom/to,limit(1 to 200, default 200) andoffset(SecurityAnomaliesQuerySchema). It usesfindAndCountAll, sototalis every match in the window rather than the length of the capped page. It also returnswindow,limitandoffset.Contract / ripple
@seamless-auth/types0.28.0 (types#91) adds the query schemas and the optional response fields. Older clients keep parsing.getDashboardMetricsHandlerandgetSecurityAnomaliesHandlerin core are built without a query today, so the range never reaches the API. They need to switch to theWithQueryshape and join the query-forwarding tests. I'll do that next.Checks
npm run typecheck,npm run lint,npm run format:check,npm run build,npm run coverage(1722 passed, 95.21% branches). New integration tests cover the default window and paging, a requested window with a realtotal, rejection of a reversed range and an oversized page, ranged dashboard figures beside unchanged*24hones, and the no-range path counting once.