Skip to content

[O2B-1644] Add general logging middleware for improved statistics - #2295

Merged
graduta merged 5 commits into
mainfrom
feature/O2B-1644/improve-general-request-API-logging
Oct 26, 2026
Merged

graduta merged 5 commits into
mainfrom
feature/O2B-1644/improve-general-request-API-logging

Conversation

@graduta

@graduta graduta commented Oct 26, 2026

Copy link
Copy Markdown
Member

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • N/A

Notable changes for developers:

  • A general logging middleware has been added and registered to the HTTP api (after the jwt verification) to extract statistics on the most used endpoints and if needed improvements on efficiency of them

Changes made to the database:

  • N/A

@graduta graduta self-assigned this Oct 26, 2026
@graduta
graduta requested a review from isaachilly as a code owner October 26, 2026 11:47
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.76%. Comparing base (4b95835) to head (1966c9f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2295      +/-   ##
==========================================
+ Coverage   45.73%   45.76%   +0.03%     
==========================================
  Files        1066     1065       -1     
  Lines       17544    17538       -6     
  Branches     3241     3242       +1     
==========================================
+ Hits         8024     8027       +3     
+ Misses       9520     9511       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Requests traversing both API routers can generate duplicate log entries and inflate endpoint usage statistics.

1 open issue
What changed in this PR

This PR replaces endpoint-specific filter logging with shared HTTP API access logging to support endpoint usage and response-time statistics.

Changes:

  • Adds structured access logs with route, status, duration, user, response size, and token-filtered query data.
  • Registers logging on both API routers and removes the previous filter logger.
  • Adds middleware tests and documents the log format.
File Description
test/​lib/​server/​middleware/​index.js Registers access-log tests.
test/​lib/​server/​middleware/​accessLog.middleware.test.js Tests logging, token exclusion, aborted responses, and silent mode.
lib/​server/​WebUiServer.js Registers logging on both API routers.
lib/​server/​routers/​simulationPasses.router.js Removes endpoint-specific logging.
lib/​server/​routers/​runs.router.js Removes endpoint-specific logging.
lib/​server/​routers/​qcFlag.router.js Removes endpoint-specific logging.
lib/​server/​routers/​logs.router.js Removes endpoint-specific logging.
lib/​server/​routers/​lhcPeriodsStatistics.router.js Removes endpoint-specific logging.
lib/​server/​routers/​lhcFills.router.js Removes endpoint-specific logging.
lib/​server/​routers/​environments.router.js Removes endpoint-specific logging.
lib/​server/​routers/​dataPasses.router.js Removes endpoint-specific logging.
lib/​server/​middleware/​InfoLoggerListener.middleware.js Deletes the previous logging middleware.
lib/​server/​middleware/​index.js Exports the access-log middleware.
lib/​server/​middleware/​accessLog.middleware.js Implements structured response-completion logging.
lib/​server/​Loggers/​FilterLogger.js Deletes the filter-specific logger.
docs/​backend-architecture.md Documents access-log fields and behavior.

Review effort: Balanced

Comment thread lib/server/WebUiServer.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Router ordering, authenticated-route coverage, static-file exclusion, and local-only log delivery need integration verification against the external HTTP framework.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@graduta
graduta merged commit 640b28e into main Oct 26, 2026
27 checks passed
@graduta
graduta deleted the feature/O2B-1644/improve-general-request-API-logging branch October 26, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants