feat: API response time logging, delivery failure reasons, config validation, notification sorting - #565
Open
Lost-Z wants to merge 1 commit into
Open
Conversation
…idation, notification sorting Closes Core-Foundry#491 Closes Core-Foundry#493 Closes Core-Foundry#494 Closes Core-Foundry#495 ## Core-Foundry#491 — Add API Response Time Logging - New ResponseTimeMiddleware (listener/src/middleware/response-time.ts) - Records start time per request via res object symbol key - Sets X-Response-Time header on every response - Logs completed requests at INFO; flags slow requests at WARN - Tracks totalRequests, slowRequests, totalResponseTimeMs, maxResponseTimeMs - slowRequestThresholdMs defaults to 1000 ms (configurable via EventsServerOptions) - Wire middleware into createEventsServer: start() at request open, finish() at 404 fallthrough - New GET /api/metrics/response-time endpoint exposes counters; ?reset=true resets them ## Core-Foundry#493 — Add Delivery Failure Reasons - NotificationSearchService: add failureReason field to NotificationSearchResult - Populated from last_error (scheduled_notifications) and error_reason (processed_events) - Dashboard eventsApi.ts: expose failureReason on NotificationSearchResult - NotificationSearchPage: render Failure reason row in NotificationResultCard when present ## Core-Foundry#494 — Improve Configuration Validation - New validateConfig(config) in listener/src/config.ts - Validates all critical fields: RPC URL format, port range, poll intervals, scheduler lock/batch settings, retry multiplier/delay ordering, rate-limit minimums, analytics bucket size, cleanup retention floor - Collects all violations before throwing so operators see every problem at once - Throws ConfigError with numbered list of descriptive messages - index.ts: call validateConfig(config) immediately after loadConfig() so invalid configuration blocks startup before any service initialises ## Core-Foundry#495 — Add Notification Sorting Options - New NotificationSortOption type (newest | oldest | priority | delivery_status) added to dashboard/src/types/event.ts; sortBy field added to EventFilters - sortEvents() utility in eventData.ts implements all four sort strategies; filterEvents() accepts and applies sortBy parameter - EventFiltersBar: Sort by dropdown persists selection to localStorage via setSortBy - eventStore: setSortBy action writes to localStorage; loadPersistedSort() restores on init; selectFilteredEvents and useFilteredEvents pass sortBy through - Server-side: NotificationSearchParams.sortBy (newest | oldest | status) added; NotificationSearchService.search() applies sort before pagination - events-server: extracts sortBy query param and forwards to search service - NotificationSearchPage: Sort by dropdown (newest/oldest/status); included in filtersKey so page resets on sort change; cleared by Clear filters
|
@Lost-Z Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Implements four issues in a single PR.
Closes #491 — Add API Response Time Logging
ResponseTimeMiddleware(listener/src/middleware/response-time.ts)ServerResponseX-Response-Timeheader on every responseINFO; flags requests exceedingslowRequestThresholdMs(default 1 000 ms) atWARNtotalRequests,slowRequests,totalResponseTimeMs,maxResponseTimeMsslowRequestThresholdMsis configurable viaEventsServerOptionscreateEventsServer:start()at request open,finish()at the 404 fallthroughGET /api/metrics/response-timeendpoint exposes counters;?reset=trueresets themCloses #493 — Add Delivery Failure Reasons
NotificationSearchService:failureReasonfield added toNotificationSearchResultlast_error(scheduled_notifications) anderror_reason(processed_events)eventsApi.ts:failureReasonexposed onNotificationSearchResultNotificationSearchPage: renders a Failure reason row inNotificationResultCardwhen the field is non-nullCloses #494 — Improve Configuration Validation
validateConfig(config)exported fromlistener/src/config.tsConfigErrorwith a numbered list of descriptive messagesindex.ts:validateConfig(config)is called immediately afterloadConfig()— invalid configuration blocks startup before any service initialisesCloses #495 — Add Notification Sorting Options
NotificationSortOptiontype (newest | oldest | priority | delivery_status) added todashboard/src/types/event.ts;sortByfield added toEventFilterssortEvents()utility ineventData.tsimplements all four strategies;filterEvents()accepts and appliessortByEventFiltersBar: Sort by dropdown; selection persisted tolocalStorageviasetSortByso it survives page refresheseventStore:setSortByaction writes tolocalStorage;loadPersistedSort()restores on init;selectFilteredEventsanduseFilteredEventsthreadsortBythroughNotificationSearchParams.sortBy(newest | oldest | status) added toNotificationSearchService; sort applied before paginationevents-server: extractssortByquery param and forwards to the search serviceNotificationSearchPage: Sort by dropdown (newest / oldest / status); included infiltersKeyso page resets on sort change; reset by Clear filters