-
Notifications
You must be signed in to change notification settings - Fork 277
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
[fix] #4030, #4063, #4064, #4079: re-architect logger and dynamic configuration #4100
Merged
0x009922
merged 28 commits into
hyperledger-iroha:iroha2-dev
from
0x009922:logger-and-config-actors
Dec 12, 2023
Merged
[fix] #4030, #4063, #4064, #4079: re-architect logger and dynamic configuration #4100
0x009922
merged 28 commits into
hyperledger-iroha:iroha2-dev
from
0x009922:logger-and-config-actors
Dec 12, 2023
Conversation
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
0x009922
added
Enhancement
New feature or request
iroha2-dev
The re-implementation of a BFT hyperledger in RUST
api-changes
Changes in the API for client libraries
config-changes
Changes in configuration and start up of the Iroha
Refactor
Improvement to overall code quality
labels
Nov 30, 2023
0x009922
changed the title
[fix] #4030 #4063 #4064: re-architect logger and dynamic configuration
[fix] #4030 #4063 #4064 #4079: re-architect logger and dynamic configuration
Nov 30, 2023
0x009922
changed the title
[fix] #4030 #4063 #4064 #4079: re-architect logger and dynamic configuration
[fix] #4030, #4063, #4064, #4079: re-architect logger and dynamic configuration
Nov 30, 2023
6 tasks
Erigara
reviewed
Nov 30, 2023
DCNick3
reviewed
Nov 30, 2023
DCNick3
reviewed
Nov 30, 2023
Erigara
reviewed
Nov 30, 2023
0x009922
commented
Dec 4, 2023
0x009922
force-pushed
the
logger-and-config-actors
branch
from
December 5, 2023 01:57
60beea1
to
174ee74
Compare
Pull Request Test Coverage Report for Build 7175878272
💛 - Coveralls |
Erigara
reviewed
Dec 6, 2023
0x009922
requested review from
s8sato,
mversic,
Arjentix,
SamHSmith and
QuentinI
as code owners
December 6, 2023 07:06
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
mversic
force-pushed
the
logger-and-config-actors
branch
from
December 11, 2023 09:43
4ac7515
to
23bd7e6
Compare
DCNick3
reviewed
Dec 11, 2023
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Erigara
approved these changes
Dec 12, 2023
DCNick3
approved these changes
Dec 12, 2023
Asem-Abdelhady
pushed a commit
to Asem-Abdelhady/iroha
that referenced
this pull request
Jan 9, 2024
…ha#4064, hyperledger-iroha#4079: re-architect logger and dynamic configuration (hyperledger-iroha#4100) Co-authored-by: ⭐️NINIKA⭐️ <[email protected]> Signed-off-by: Dmitry Balashov <[email protected]>
Asem-Abdelhady
pushed a commit
to Asem-Abdelhady/iroha
that referenced
this pull request
Jan 22, 2024
…ha#4064, hyperledger-iroha#4079: re-architect logger and dynamic configuration (hyperledger-iroha#4100) Co-authored-by: ⭐️NINIKA⭐️ <[email protected]> Signed-off-by: Dmitry Balashov <[email protected]> Signed-off-by: Asem-Abdelhady <[email protected]>
Asem-Abdelhady
pushed a commit
to Asem-Abdelhady/iroha
that referenced
this pull request
Feb 9, 2024
…ha#4064, hyperledger-iroha#4079: re-architect logger and dynamic configuration (hyperledger-iroha#4100) Co-authored-by: ⭐️NINIKA⭐️ <[email protected]> Signed-off-by: Dmitry Balashov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api-changes
Changes in the API for client libraries
config-changes
Changes in configuration and start up of the Iroha
Enhancement
New feature or request
iroha2-dev
The re-implementation of a BFT hyperledger in RUST
Refactor
Improvement to overall code quality
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
Started by updating configuration endpoints according to #4063, this PR expanded to major update of dynamic configuration mechanism, Logger configuration (#4030, #4064) and initialisation.
Logger initialisation is a global one-time thing, which was done with
iroha_logger::init(Configuration)
function, which might accept the config and initialise logger, or might not, without an error. While initialising, it injected aReloadHandle
into the configuration instance, so that all updates toconfig.logger.max_log_level
would trigger updates set up withiniroha_logger::init
. Than thatconfig
was copied many times inTorii
and log level was actually reloaded onPOST /configuration
updates.However, the configuration value update was not reflected in subsequent
GET /configuration
requests (#4079), because each timeconfig
is copied (it was copied for each request), it was editing a copy ofconfig
without affecting an original one. Since a copy ofconfig
was still containingReloadHandle
from Logger, the log level was updated.Another problem appeared because of combination of configuration & logger architecture, in tests. It appeared that some tests ran concurrently, each calling
iroha_logger::init
with independentConfiguration
s. However, only oneiroha_logger::init
might succeed, and another silently pretends that everything is ok. It worked fine, until one of Iroha instances fails to update the log level, because itsConfiguration
passed intoiroha_logger::init
was not injected with aReloadHandle
.Shortly, the system was unsound, i.e. it was easy to misuse.
Changes in this PR:
ReloadHandle
andSyncValue
from configurationlogger.terminal_colors
setting to the CLI layer #4030 and [suggestion] Simplify logger's behaviour and configuration #4064init(Configuration) -> Result<Option<Telemetries>>
intoinit_global(Configuration) -> Result<LoggerHandle>
, initialising the Logger actor once per process, and failing if it was done alreadytest_logger() -> LoggerHandle
, lazily initialising the Logger actor with pre-defined configuration, suitable for testsChores:
Linked issue
Closes #4030 #4063 #4064 #4079
Benefits
Checklist
bunyan
can parse current JSON output202 Accepted
forPOST /configuration
Migration guide
Update Logger configuration
In the configuration file, under
LOGGER.*
namespace:MAX_LOG_LEVEL
toLEVEL
COMPACT_MODE
; useFORMAT: "full"
(iffalse
) andFORMAT: "compact"
(iftrue
) insteadLOG_FILE_PATH
; useFORMAT: "json"
instead and redirect stdout to a file, e.g.iroha > log.json
TERMINAL_COLORS
; use--terminal-colors
/--no-terminal-colors
CLI arguments insteadTELEMETRY_CAPACITY
Env variables:
LOG_LEVEL
: instead ofMAX_LOG_LEVEL
LOG_FORMAT
: new parameterLOG_TOKIO_CONSOLE_ADDR
: instead ofTOKIO_CONSOLE_ADDR
Example file before:
Example file after:
Update Kura configuration
In the configuration file, under
KURA.*
namespace, removeACTOR_CHANNEL_CAPACITY
andBLOCKS_PER_STORAGE_FILE
fields.Update configuration endpoints usage
GET /configuration
now returns JSON with only{ logger: { level } }
.POST /configuration
now accepts JSON in the same shapePOST /configuration
request before:POST /configuration
request after: