Open kofoworola opened 4 days ago
Knock Knock! π
Just thought I'd let you know that your PR title and story title look quite different. PR titles that closely resemble the story title make it easier for reviewers to understand the context of the PR.
An easy-to-understand PR title a day makes the reviewer review away! πβ‘οΈ
Story Title | Backoff strategy for reconnection when broker is down |
---|---|
PR Title | [TT-13008]: modified default streams logger |
Check out this guide to learn more about PR best-practices.
Here are some key observations to aid the review process:
β±οΈ Estimated effort to review: 2 π΅π΅βͺβͺβͺ |
π§ͺ No relevant tests |
π No security concerns identified |
β‘ Recommended focus areas for review Configuration Hardcoding The logger configuration is hardcoded within the function, which might limit flexibility and configurability in different environments. Consider externalizing this configuration or providing a way to override these settings. |
API Changes
no api changes detected
Explore these optional code suggestions:
Category | Suggestion | Score |
Possible bug |
Check and initialize
___
**Ensure that the | 9 |
Possible issue |
Validate
___
**Consider validating the | 8 |
Best practice |
Replace magic strings and values in logger configuration with constants___ **Use constants for logger configuration values like "level", "format", and"add_timestamp" to avoid typos and facilitate changes.** [ee/middleware/streams/manager.go [90-92]](https://github.com/TykTechnologies/tyk/pull/6665/files#diff-3e372b3346d8d296e6953152c89202a634d7654f10549676af9aea8628e13dfbR90-R92) ```diff -"level": "INFO", -"format": "json", +"level": LogLevelInfo, +"format": LogFormatJSON, "add_timestamp": true, ``` Suggestion importance[1-10]: 6Why: Using constants for configuration values reduces the risk of typos and makes future changes easier, promoting best practices in code management. | 6 |
Maintainability |
Refactor logger configuration into a separate function for clarity and reuse___ **Consider extracting the logger configuration into a separate function for bettermodularity and reusability.** [ee/middleware/streams/manager.go [89-96]](https://github.com/TykTechnologies/tyk/pull/6665/files#diff-3e372b3346d8d296e6953152c89202a634d7654f10549676af9aea8628e13dfbR89-R96) ```diff -config["logger"] = map[string]interface{}{ - "level": "INFO", - "format": "json", - "add_timestamp": true, - "static_fields": map[string]interface{}{ - "stream": streamID, - }, -} +config["logger"] = getLoggerConfig(streamID) ``` Suggestion importance[1-10]: 5Why: Extracting the logger configuration into a separate function improves code modularity and reusability, enhancing maintainability, though it is not critical for functionality. | 5 |
User description
TT-13008
Description
Added a logger to created streams to change the format of logging used by benthos TT-13008
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
enhancement
Description
Changes walkthrough π
manager.go
Add logger configuration to stream creation
ee/middleware/streams/manager.go
addition.