Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TT-13155] Explicitly copy BaseMiddleware for each middleware that ta…
…kes it (#6744) <details open> <summary><a href="https://tyktech.atlassian.net/browse/TT-13155" title="TT-13155" target="_blank">TT-13155</a></summary> <br /> <table> <tr> <th>Summary</th> <td>[Regression] Gateway Debug logs starting v5.3 only logs AccessRightsCheck for most of the middlewares</td> </tr> <tr> <th>Type</th> <td> <img alt="Bug" src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium" /> Bug </td> </tr> <tr> <th>Status</th> <td>In Dev</td> </tr> <tr> <th>Points</th> <td>N/A</td> </tr> <tr> <th>Labels</th> <td><a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%20'24Bugsmash%20ORDER%20BY%20created%20DESC" title="'24Bugsmash">'24Bugsmash</a>, <a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%202025lts%20ORDER%20BY%20created%20DESC" title="2025lts">2025lts</a>, <a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%20SESAP%20ORDER%20BY%20created%20DESC" title="SESAP">SESAP</a>, <a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%20customer_bug%20ORDER%20BY%20created%20DESC" title="customer_bug">customer_bug</a>, <a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%20jira_escalated%20ORDER%20BY%20created%20DESC" title="jira_escalated">jira_escalated</a></td> </tr> </table> </details> <!-- do not remove this marker as it will break jira-lint's functionality. added_by_jira_lint --> --- ### **PR Type** Enhancement PR: - implements per-middleware basemiddleware copy behaviour - reverts the logger+mutex on base middleware - touches coprocess/ to better handle grpc server startup, shutdown, conflicts on static port number - not to swallow errors when net.Listener fails ___ ### **Description** - Refactored the `BaseMiddleware` initialization process by introducing a `NewBaseMiddleware` function, encapsulating the creation logic. - Added a `Copy` method to `BaseMiddleware` to create scoped copies with a duplicated logger, ensuring middleware-specific logging. - Updated all middleware initialization in `gateway/api_loader.go` to use `baseMid.Copy()` for better isolation and logging scope. - Enhanced code readability and maintainability by centralizing `BaseMiddleware` creation logic and ensuring proper separation of concerns. --------- Co-authored-by: Tit Petric <[email protected]>
- Loading branch information