Skip to content

Wait for a time range before loading HTTP request analytics and logs - #4099

Open
MannXo wants to merge 1 commit into
fosrl:devfrom
MannXo:feat/4096-analytics-time-range
Open

MannXo wants to merge 1 commit into
fosrl:devfrom
MannXo:feat/4096-analytics-time-range

Conversation

@MannXo

@MannXo MannXo commented Nov 12, 2026 •

Copy link
Copy Markdown

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

AI Disclosure

This change was prepared with AI assistance (Claude Code): code and description. It was reviewed before submission.

Description

Fixes #4096.

Both HTTP Requests pages (Analytics > HTTP Requests and Logs > HTTP Requests) queried the last 7 days as soon as they opened. On a busy instance that query can run long enough to make the whole server unresponsive, and there was no way to narrow the range before it started.

The pages now open without fetching anything. The date pickers still show the last 7 days, and a message asks the user to choose a time range or click Refresh to load the range shown. Picking a start or end date, or clicking Refresh, loads the data as before. A page opened with a range already in the URL loads straight away, so existing links and the filter state in the URL behave as they did.

Changes:

  • LogAnalyticsData: the analytics query is enabled only once the URL has timeStart/timeEnd or Refresh was clicked. Until then the chart shows the same blurred placeholder it uses while loading, with the new message in place of the spinner.
  • logs/request/page.tsx: the request log query is enabled only once a range was picked, Refresh was clicked, or the URL has start and end.
  • LogDataTable: new optional emptyMessage prop, used for the prompt above. Other log pages are unchanged.
  • messages/en-US.json: one new key, logsSelectTimeRange.

Screenshots

Page Before After (on open) After (Refresh clicked)
Analytics > HTTP Requests Analytics before Analytics after, on open Analytics after Refresh
Logs > HTTP Requests Request logs before Request logs after, on open Request logs after Refresh

Notes for reviewers:

  • I kept the 7-day default in the pickers so that one click on Refresh gives the old behaviour. A smaller alternative would be to keep auto-loading but shorten the default window (for example 24 hours). That still runs a query on every visit, so I went with the explicit load the issue asks for. Happy to switch if you prefer it.
  • The access, action, connection and SSH log pages use the same 7-day default and still load on open. I left them alone to keep this to the pages named in the issue.
  • This does not make the 7-day query itself cheaper. queryUniqueFilterAttributes in queryRequestAuditLog.ts still runs six distinct scans over the chosen range.

How to test?

  1. Open Analytics > HTTP Requests. No request to /logs/analytics is made, and the chart shows "Choose a time range, or click Refresh to load the last 7 days."
  2. Click Refresh, or pick a start or end date. The analytics load for that range.
  3. Open Logs > HTTP Requests. No request to /logs/request is made and the table shows the same message.
  4. Click Refresh, or pick a date. The logs load.
  5. Open either page with a range in the URL (?timeStart=...&timeEnd=... on analytics, ?start=...&end=... on the request logs). It loads immediately, as before.

Checked locally on the SQLite OSS build with 1,500 seeded request log rows, counting API calls in a headless browser. Before the change each page made one logs API call on open. After it, zero on open and one after Refresh. npx tsc --noEmit passes under both set:oss and set:enterprise, npm test passes (19/19 files), npx next build succeeds, and Prettier is clean on the changed files.

The HTTP Analytics and HTTP Request Logs pages queried the last 7 days
as soon as they opened. On busy instances that query can take long
enough to make the server unresponsive. Both pages now wait until a
time range is picked or Refresh is clicked.

Fixes fosrl#4096
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