Skip to content

[O2B-1644] Reuse the API logger in gRPC as well to log all requests via its endpoints - #2296

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

graduta merged 3 commits into
mainfrom
feature/O2B-1644/improve-general-request-gRPC-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:

  • API logging has been extracted into a reusable format so that both HTTP and gRPC API endpoints are logged
  • the params (gRPC) and query (HTTP) will be logged in the JSON under the params so that an OpenSearch dashboard can be used for both types
  • Because majority of gRPC calls are for creation/update of data, the logs are capped at 500 characters length

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 13:52
@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.96%. Comparing base (640b28e) to head (20e506b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2296      +/-   ##
==========================================
+ Coverage   45.76%   45.96%   +0.19%     
==========================================
  Files        1065     1067       +2     
  Lines       17538    17589      +51     
  Branches     3242     3252      +10     
==========================================
+ Hits         8027     8084      +57     
+ Misses       9511     9505       -6     

☔ 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

gRPC logs read controller-mutated requests, losing run identifiers and requested changes.

1 open issue
What changed in this PR

This PR extracts HTTP access logging into a shared utility and extends it to gRPC endpoints, providing a common log format for OpenSearch.

Changes:

  • Adds shared request logging with protocol identifiers and truncated params strings.
  • Integrates logging into HTTP middleware and gRPC controller bindings.
  • Adds logging tests and updates backend and gRPC documentation.
File Description
test/​lib/​server/​utilities/​index.js Registers the shared logger tests.
test/​lib/​server/​utilities/​ApiRequestLogger.test.js Tests formatting, truncation, error handling, and timing.
test/​lib/​server/​middleware/​accessLog.middleware.test.js Updates HTTP assertions for the shared format.
test/​gRPC/​serviceImplementation.test.js Tests logging of successful and failed gRPC calls.
lib/​server/​utilities/​ApiRequestLogger.js Implements shared request formatting and logging.
lib/​server/​middleware/​accessLog.middleware.js Delegates HTTP logging to the shared utility.
lib/​server/​gRPC/​bindGRPCController.js Adds request logging around gRPC handlers.
lib/​domain/​enums/​ApiProtocols.js Defines shared protocol identifiers.
docs/​grpc.md Documents gRPC call logging.
docs/​backend-architecture.md Documents the unified access-log format.

Review effort: Balanced

Comment thread lib/server/gRPC/bindGRPCController.js Outdated
@graduta
graduta merged commit 2157bd9 into main Oct 26, 2026
80 of 83 checks passed
@graduta
graduta deleted the feature/O2B-1644/improve-general-request-gRPC-logging branch October 26, 2026 14:36
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