-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18768 from SimonRichardson/logger-context-v3
juju#18768 Introduces `context.Context` to the `logger.Logger` interface. The main driver behind this is the following: - For all model facade requests, a model uuid is inserted into the context[1]. This will allow us to annotate all lot messages with a model uuid. This will pay dividends when we're exporting all logs to loki or similar. This also has the advantage that logs can be bifurcated based on the uuid to different log files for machines. - Trace IDs can also be associated with log messages, so it will be possible to see which logs are associated with a trace. - Status history epic. Long term we don't want to store the information in the database, instead we want the information be part of the logging system. For this to work, we need the model UUID to be part of the logs (first point), but more work is required to make sure the model UUID is part of the model workers. That will have to be added later. - This opens up the avenue for using the std library slog package in the future. 1. https://github.com/juju/juju/blob/5e972995681ae74a95bef063a31e4e253e6157c7/apiserver/apiserver.go#L1085-L1088 --- The code is relatively simple, it just introduces a context.Context as part of the method signature and the wire up of the context either via a TODO or Background context is used. --- This pull request introduces the use of the `context.TODO()` function in multiple logging statements across various files. The main goal is to ensure that context is passed consistently to logging functions. The most important changes include modifications in the logging statements within the `agent` package and its sub-packages. ### Changes to logging statements: * [`agent/addons/addons.go`](diffhunk://#diff-0191ac6f46a09950e162024d968a73443d818f06ee6723204b5da9bdfd4e569cL59-R60): Added `context.TODO()` to logging statements in the `StartIntrospection` function. [[1]](diffhunk://#diff-0191ac6f46a09950e162024d968a73443d818f06ee6723204b5da9bdfd4e569cL59-R60) [[2]](diffhunk://#diff-0191ac6f46a09950e162024d968a73443d818f06ee6723204b5da9bdfd4e569cL82-R86) * [`agent/agent.go`](diffhunk://#diff-62b6ad581fe3a3059ae8c85ef0f31dde4092bfdecfa7d6857c470bcacaa8cc8bL674-R675): Added `context.TODO()` to logging statements in several functions, including `ReadConfig`, `ParseConfigData`, and `SetAPIHostPorts`. [[1]](diffhunk://#diff-62b6ad581fe3a3059ae8c85ef0f31dde4092bfdecfa7d6857c470bcacaa8cc8bL674-R675) [[2]](diffhunk://#diff-62b6ad581fe3a3059ae8c85ef0f31dde4092bfdecfa7d6857c470bcacaa8cc8bL685-R686) [[3]](diffhunk://#diff-62b6ad581fe3a3059ae8c85ef0f31dde4092bfdecfa7d6857c470bcacaa8cc8bL725-R726) * [`agent/agentbootstrap/bootstrap.go`](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL297-R298): Added `context.TODO()` to logging statements in the `Initialize` and `initBootstrapMachine` functions. [[1]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL297-R298) [[2]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL324-R325) [[3]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL382-R383) [[4]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL461-R462) [[5]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL530-R537) [[6]](diffhunk://#diff-ea4f262b8f5d83da16a99c2bcc52a1156553e069197bb2dd9476f3a6db6b88ffL558-R559) * [`agent/errors/errors.go`](diffhunk://#diff-8cbdaee7b46342e4d485da5552e2d068ff1036ef7c1fa2298099a069304c2c4fL44-R44): Added `context.TODO()` to logging statements in `ChangeAgentTools` and `PingerIsFatal` functions. [[1]](diffhunk://#diff-8cbdaee7b46342e4d485da5552e2d068ff1036ef7c1fa2298099a069304c2c4fL44-R44) [[2]](diffhunk://#diff-8cbdaee7b46342e4d485da5552e2d068ff1036ef7c1fa2298099a069304c2c4fL164-R164) * [`api/apiclient.go`](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L501-R505): Added `context.TODO()` to logging statements in several functions, including `dialAPI`, `next`, and `lookupIPAddr`. [[1]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L501-R505) [[2]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L563-R563) [[3]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L681-R681) [[4]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L786-R794) [[5]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L918-R918) [[6]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L930-R930) [[7]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L1012-R1012) [[8]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L1025-R1028) [[9]](diffhunk://#diff-5dad8af7a39fbc96262fc8f20b0829d71567703b4d4553c1578cb8fb49aad5d8L1055-R1055) ## QA Steps ```sh $ juju bootstrap lxd test $ juju add-model default $ juju deploy ubuntu ```
- Loading branch information
Showing
720 changed files
with
4,438 additions
and
3,932 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.