Skip to content

fix: set transformed request body in logs service requestParams field#1246

Merged
VisargD merged 1 commit into
mainfrom
fix/logs-service-request-params-mapping
Jul 28, 2025
Merged

fix: set transformed request body in logs service requestParams field#1246
VisargD merged 1 commit into
mainfrom
fix/logs-service-request-params-mapping

Conversation

@VisargD

@VisargD VisargD commented Jul 26, 2025

Copy link
Copy Markdown
Collaborator

Description

Reverting the change done in #1121 to align it with the older implementation

Motivation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

@matterai-app

matterai-app Bot commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

Code Quality bug fix

Summary By MatterAI MatterAI logo

🔄 What Changed

This PR fixes an issue with the logs service by setting the transformed request body in the requestParams field of the log data. The change ensures that the transformed request body is properly captured in the logs for better debugging and monitoring.

🔍 Impact of the Change

The impact is improved logging capabilities. By correctly setting the requestParams field with the transformed request body, the logs will now contain the actual data that was processed after any transformations, making debugging and troubleshooting more effective.

📁 Total Files Changed

  • src/handlers/services/logsService.ts - Updated to set the transformed request body in the logData.requestParams field

🧪 Test Added

N/A - No tests were added in this PR.

🔒 Security Vulnerabilities

N/A - No security vulnerabilities were identified in this change.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Tip

Quality Recommendations

  1. Consider adding unit tests to verify the logging behavior with transformed request bodies

  2. Add a comment explaining why this change was necessary for better code maintainability

Tanka Poem ♫

Logs transform and flow,
Data captured with new care,
Debugging made clear,
Invisible becomes seen,
🔍 Truth in every request.

Sequence Diagram

sequenceDiagram
    participant Client
    participant RequestHandler
    participant LogsService
    participant LogStorage
    
    Client->>RequestHandler: Send Request
    RequestHandler->>RequestHandler: Transform Request Body
    RequestHandler->>LogsService: setRequestContext(transformedRequestBody, headers)
    Note over LogsService: Previous: Only set in context object
    Note over LogsService: Now: Also set in logData.requestParams
    LogsService->>LogsService: Set context.transformedRequestBody
    LogsService->>LogsService: Set logData.requestParams = transformedRequestBody
    LogsService-->>RequestHandler: Return LogsService instance
    RequestHandler->>LogStorage: Log request with complete data
Loading

@matterai-app matterai-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR makes a simple but important fix to ensure the transformed request body is properly captured in logs. The implementation looks correct, though I have a minor suggestion to improve code clarity.

Comment thread src/handlers/services/logsService.ts
@VisargD VisargD requested review from b4s36t4 and narengogi July 28, 2025 05:42
@VisargD VisargD merged commit 405c15d into main Jul 28, 2025
1 check passed
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.

3 participants