Simplify logging infrastructure and refactor audit handling#1010
Open
cgalibern wants to merge 10 commits intoopensvc:mainfrom
Open
Simplify logging infrastructure and refactor audit handling#1010cgalibern wants to merge 10 commits intoopensvc:mainfrom
cgalibern wants to merge 10 commits intoopensvc:mainfrom
Conversation
…nitialization - Attach active audit early in `worker` lifecycle for improved initialization. - Increase log level from `Tracef` to `Debugf` for config update messages. - Add log message upon new configuration publication for better traceability.
- Introduce `head` to manage logger chain and ensure proper cloning behavior. - Adjust queue (`q`) handling logic for consistency across logger instances. - Simplify and streamline attribute addition with centralized cloning logic. This commit enables the master queue manager (ie the head logger) q value is cloned on children (Attr/Prefix...). It will be used on the lsnrhttpinet & lsnrhttpux.
This commit fixes following issues:
- restarts listener on audit requests: leads to unavailable ux socket during audit AuditStart/AuditStop
- janitor.start func routine hang on: err := <-errC
start := func() error {
t.log.Infof("janitor ask for start")
errC := make(chan error)
go t.Start(ctx)
err := <-errC
- Unexpected log attribute "pkg": "daemon/listener/lsnrhttpinet".
- Unexpected log prefix: "daemon: listener: inet:".
Implementation:
- Simplify janitor by removing unused `start` and `restart` logic.
- Introduce logger injection in `lsnrhttpux` initialization using `WithLogger`.
So the api middleware will inherit the head logger and its queue setting
- Replace `LogQueue` with `Logger` for streamlined logger context management.
- Refactor `WithLogQueue` and `LogQueue` to `WithLogger` and `Logger`.
- Remove unused `slices` import and redundant janitor restart logic.
- Adjust audit subsystem handling for improved API-based filtering.
…ddr reassignments
will restart: addr changed :0 -> :0
instead of
will restart: addr changed :0 -> :1215
This commit simplifies logger injection and streamline audit handling - Remove redundant `slices` import and unused restart logic. - Inject logger directly into context using `WithLogger`. - Refactor audit subsystem handling for targeted API filtering (`api`, `api.inet`, `api.ux`). - Eliminate outdated queue (`LogQueue`) management in favor of streamlined logger context.
- Refactor `logWithFamilyAndAddr` to derive logger attributes directly from context. - Remove redundant `LogQueue` management in favor of direct context-based logger setup. - Consolidate logger initialization to streamline middleware logic. - Preserve log prefixes across request contexts.
Simplify logger setup and refactor log handling - Replace individual logger creation with `logSetOrchestrationID` for consistency. - Consolidate logger prefix management to ensure dynamic updates during state changes. - Remove redundant logger initialization methods (`newLogger`, `newResourceLogger`).
- Add timeouts to ensure preempt channel operations do not block indefinitely. - Verify if preempt is still needed when session might be closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request simplifies and improves the logging infrastructure across various components by addressing several inefficiencies, unused methods, and redundant logic. It also resolves multiple issues related to audit handling and listener management.
Key Changes:
Logger Refactor:
WithQmethod from theLoggerclass.headlogger.LogQueuewith simplified direct context-based logger setup.Audit Handling Improvements:
attachActiveAuditIfAnyfor improvedworkerinitialization.Middleware and Listener Changes:
WithLogger.Type of Change