-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Merging to release-5.2: TT-11288 Revert logger mutex (#6103) #6104
Merging to release-5.2: TT-11288 Revert logger mutex (#6103) #6104
Conversation
## **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description Remove the mutex for the logger ## Related Issue TT-11288 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] 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 change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ## **Type** bug_fix ___ ## **Description** - Removed the mutex lock from the logger in the `BaseMiddleware` struct to address potential performance issues and simplify the code. - Updated methods (`Base()`, `Logger()`, `SetName()`, and `SetRequestLogger()`) in `BaseMiddleware` to operate without mutex synchronization. ___ ## **Changes walkthrough** <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>middleware.go</strong><dd><code>Remove Logger Mutex in BaseMiddleware</code> </dd></summary> <hr> gateway/middleware.go <li>Removed mutex (<code>sync.Mutex</code>) for logger in <code>BaseMiddleware</code> struct.<br> <li> Simplified <code>Base()</code>, <code>Logger()</code>, <code>SetName()</code>, and <code>SetRequestLogger()</code> methods <br>by removing mutex locks and unlocks.<br> <li> Ensured logger instance is directly manipulated without mutex <br>synchronization. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6103/files#diff-703054910891a4db633eca0f42ed779d6b4fa75cd9b3aa4c503e681364201c1b">+8/-32</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > ✨ **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit bb3ad6a)
PR Description updated to latest commit (ab65e98) |
API Changes --- prev.txt 2024-03-06 13:46:02.087486844 +0000
+++ current.txt 2024-03-06 13:45:58.647441224 +0000
@@ -6771,8 +6771,8 @@
type BaseMiddleware struct {
Spec *APISpec
Proxy ReturningHttpHandler
- Gw *Gateway `json:"-"`
+ Gw *Gateway `json:"-"`
// Has unexported fields.
}
BaseMiddleware wraps up the ApiSpec and Proxy objects to be included in a
@@ -6782,7 +6782,7 @@
ApplyPolicies will check if any policies are loaded. If any are, it will
overwrite the session state to use the policy values.
-func (t *BaseMiddleware) Base() *BaseMiddleware
+func (t BaseMiddleware) Base() *BaseMiddleware
func (t BaseMiddleware) CheckSessionAndIdentityForValidKey(originalKey string, r *http.Request) (user.SessionState, bool)
CheckSessionAndIdentityForValidKey will check first the Session store for a |
PR Review
Code feedback:
✨ Review tool usage guide:Overview:
With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
Quality Gate failedFailed conditions |
API tests result: success ✅ |
User description
TT-11288 Revert logger mutex (#6103)
User description
Description
Remove the mutex for the logger
Related Issue
TT-11288
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
functionality to change)
coverage to functionality)
Checklist
why it's required
explained why
Type
bug_fix
Description
BaseMiddleware
structto address potential performance issues and simplify the code.
Base()
,Logger()
,SetName()
, andSetRequestLogger()
) inBaseMiddleware
to operate without mutexsynchronization.
Changes walkthrough
middleware.go
Remove Logger Mutex in BaseMiddleware
gateway/middleware.go
sync.Mutex
) for logger inBaseMiddleware
struct.Base()
,Logger()
,SetName()
, andSetRequestLogger()
methodsby removing mutex locks and unlocks.
synchronization.
Type
bug_fix
Description
BaseMiddleware
struct to address potential performance issues and simplify the code.Base()
,Logger()
,SetName()
, andSetRequestLogger()
) inBaseMiddleware
to operate without mutex synchronization, enhancing performance and code simplicity.Changes walkthrough
middleware.go
Remove Mutex Synchronization from Logger in BaseMiddleware
gateway/middleware.go
sync.Mutex
) for logger inBaseMiddleware
struct.Base()
,Logger()
,SetName()
, andSetRequestLogger()
methods tooperate without mutex synchronization.