Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use common logging middleware #6865

Merged
merged 7 commits into from
Jan 22, 2025
Merged

fix: use common logging middleware #6865

merged 7 commits into from
Jan 22, 2025

Conversation

nityanandagohain
Copy link
Member

@nityanandagohain nityanandagohain commented Jan 21, 2025

Part of https://github.com/SigNoz/platform-pod/issues/406

  • uses the logging middleware from middleware pkg.
  • for private server privatePort = true, is added for all the logs.
  • modified the middleware to support static fields.
  • there was a spelling mistake where we used tprivatePort instead of privatePort in QS.

Important

Replaces custom logging middleware with a common one, fixes a typo in logging fields, and enhances the Wrap function for static fields in logging.go.

  • Middleware:
    • Replaces custom loggingMiddleware and loggingMiddlewarePrivate with middleware.NewLogging(zap.L()).Wrap in server.go.
    • Removes old logging middleware implementations from server.go.
  • Logging:
    • Fixes typo tprivatePort to privatePort in logging fields.
    • Modifies Wrap function in logging.go to handle static fields and improve error logging.
  • Misc:
    • Removes unused context field in Wrap function in logging.go.

This description was created by Ellipsis for 08d5cae. It will automatically update as commits are pushed.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added docs required enhancement New feature or request labels Jan 21, 2025
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

1 similar comment
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 57a1a62 in 1 minute and 29 seconds

More details
  • Looked at 195 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. pkg/http/middleware/logging.go:44
  • Draft comment:
    The context is no longer being logged. If this was intentional, please ignore. Otherwise, consider adding zap.Any("context", req.Context()) to the fields.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a new logging middleware and removes the old one. However, the new middleware does not log the context, which was present in the old middleware. This might be an oversight.
2. pkg/http/middleware/logging.go:68
  • Draft comment:
    Consider handling the case where the response body is empty for status codes 400 or >=500, similar to the old middleware.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR removes the old logging middleware and replaces it with a new one. However, the new middleware does not handle the case where the response body is empty for status codes 400 or >=500. This might be an oversight.

Workflow ID: wflow_yE2xeC6Oickatwq6


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@nityanandagohain nityanandagohain changed the title feat: use common logging middleware fix: use common logging middleware Jan 21, 2025
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

pkg/http/middleware/logging.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the bug Something isn't working label Jan 22, 2025
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on dd208e2 in 23 seconds

More details
  • Looked at 26 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. ee/query-service/app/server.go:325
  • Draft comment:
    The PR description mentions a spelling mistake correction from tprivatePort to privatePort, but this change is not reflected here. Ensure that the correction is made where necessary.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. pkg/query-service/app/server.go:269
  • Draft comment:
    The PR description mentions a spelling mistake correction from tprivatePort to privatePort, but this change is not reflected here. Ensure that the correction is made where necessary.
  • Reason this comment was not posted:
    Marked as duplicate.
3. ee/query-service/app/server.go:325
  • Draft comment:
    Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This applies to other instances of middleware.NewLogging(zap.L()).Wrap as well.
  • Reason this comment was not posted:
    Comment did not seem useful.
4. pkg/query-service/app/server.go:269
  • Draft comment:
    Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This applies to other instances of middleware.NewLogging(zap.L()).Wrap as well.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_HDj56w93GNoJhF73


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on bf5fed0 in 38 seconds

More details
  • Looked at 31 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. pkg/http/middleware/logging.go:49
  • Draft comment:
    The staticFields are removed from the Logging struct and not used in the Wrap method. If the intent is to support static fields, consider adding them back to the log fields.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The removal of staticFields appears intentional since it's removed from both the struct and its usage. The constructor still accepting staticFields is likely an oversight. This seems like a cleanup/refactor where unused functionality was removed. The comment suggests adding the fields back, but if they were intentionally removed, this suggestion isn't helpful.
    The code could be inconsistent since NewLogging still accepts staticFields but doesn't use them. Maybe there are other parts of the codebase that expect this functionality.
    While the constructor parameter is inconsistent, the removal of staticFields appears intentional. If other parts of the codebase needed this functionality, the build would fail when trying to use the removed fields.
    The comment should be deleted as it suggests restoring intentionally removed functionality without strong evidence that it's needed.
2. pkg/http/middleware/logging.go:25
  • Draft comment:
    Consider re-adding the staticFields to ensure consistent logging across different parts of the application.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_EnmWxlze5RoTHYG2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 08d5cae in 12 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. pkg/http/middleware/logging.go:22
  • Draft comment:
    No issues found with the specified rules.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The code does not violate any of the specified rules. It uses external logging and does not hardcode colors or use inline styles. The file structure is not component/index.tsx, and there are no non-ClickHouse related functions in ClickHouseReader interface.

Workflow ID: wflow_fTTEwItkFTDOlxAm


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@nityanandagohain nityanandagohain enabled auto-merge (squash) January 22, 2025 07:18
@nityanandagohain nityanandagohain merged commit 4a0b0aa into main Jan 22, 2025
16 checks passed
@nityanandagohain nityanandagohain deleted the issue_406_1 branch January 22, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs not required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants