-
Notifications
You must be signed in to change notification settings - Fork 547
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
removing compile time config load logging from cli #16403
Conversation
!ci-build-me |
@@ -1802,14 +1791,8 @@ module Json_loader : Json_loader_intf = struct | |||
| Ok loaded_config -> | |||
combine config loaded_config | |||
| Error err -> | |||
[%log fatal] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that we won't see the failure reason in the node logs, and so we'll have a harder time root-causing crashes if node operators hit this :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this specific log, won't node operators just see the error in the exception back trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on how they're running the node, and whether they're collecting error messages instead of logs. Most only have logs.
!ci-build-me |
!ci-build-me |
!ci-build-me |
!ci-nightly-me |
!ci-build-me |
!ci-nightly-me |
!ci-build-me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need two explicit versions of load_constants
: with and without the logging.
In many contexts where logging was removed now it's actually useful to have, and violates no "contract" with users
@@ -22,10 +22,8 @@ let command = | |||
let open Async in | |||
let open Deferred.Let_syntax in | |||
let%bind constraint_constants, proof_level = | |||
let logger = Logger.create () in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_file | ||
in | ||
let%map conf = Runtime_config.Constants.load_constants config_file in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
@@ -1567,7 +1567,7 @@ let internal_commands ~itn_features logger = | |||
let open Deferred.Let_syntax in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants config_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
@@ -1599,7 +1599,7 @@ let internal_commands ~itn_features logger = | |||
let open Deferred.Let_syntax in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants config_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
@@ -1656,7 +1656,7 @@ let internal_commands ~itn_features logger = | |||
let open Async in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants config_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
src/app/cli/src/init/client.ml
Outdated
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_files | ||
in | ||
let%map conf = Runtime_config.Constants.load_constants config_files in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
let%map constants = | ||
Runtime_config.Constants.load_constants ~logger config_file | ||
in | ||
let%map constants = Runtime_config.Constants.load_constants config_file in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
Changes to this whole file should be reverted, I think
@@ -2028,13 +2028,14 @@ module Constants : Constants_intf = struct | |||
|
|||
(* Use this function if you don't need/want the ledger configuration *) | |||
let load_constants ?conf_dir ?commit_id_short ?itn_features ?cli_proof_level | |||
~logger config_files = | |||
config_files = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that we rename this function to load_constants_with_logging
and have an explicit ~logger
parameter: let load_constants = load_constants_with_logging ~logger:(Logger.null ())
src/lib/snark_worker/functor.ml
Outdated
@@ -363,7 +363,7 @@ module Make (Inputs : Intf.Inputs_intf) : | |||
let%bind.Deferred constraint_constants, proof_level, compile_config = | |||
let%map.Deferred config = | |||
Runtime_config.Constants.load_constants ?conf_dir ?cli_proof_level | |||
~logger config_file | |||
config_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right to me
…snark functor and apps
!ci-build-me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fully addresses the issue of logging originated in load_config_files
appearing in unexpected contexts.
Usages of load_config_files
can be classified as follows:
- Direct usages in long-running processes (
mina
,archive
), tests andgenesis_ledger_helper
- Direct usage in a CLI command
- Usages in
load_constants
andload_compile_config
First category functions well, so no need for a change. Latter two categories are fully addressed on a case-by-case basis.
P.S. left a thread of comments while performing this review, for bookkeeping.
@@ -1777,6 +1777,7 @@ module Json_loader : Json_loader_intf = struct | |||
in | |||
[%log info] "Reading configuration files $config_files" | |||
~metadata:[ ("config_files", `List config_files_paths) ] ; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -43,8 +43,8 @@ let or_error_str ~f_ok ~error = function | |||
| Error e -> | |||
sprintf "%s\n%s\n" error (Error.to_string_hum e) | |||
|
|||
let load_compile_config ?(logger = Logger.null ()) config_files = | |||
let%map conf = Runtime_config.Constants.load_constants ~logger config_files in | |||
let load_compile_config config_files = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment from review:
- For usages of
load_compile_config
with no~logger
provided, things remain the same - For usages of
load_compile_config
that were supplying~logger
, compiler would mark all of the occasions and these would have appeared in the PR's diff (none appears, hence there were no such usages)
@@ -1567,7 +1567,8 @@ let internal_commands ~itn_features logger = | |||
let open Deferred.Let_syntax in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants_with_logging ~logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No-op change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we want logging on for this component (assuming internal commands aren't used in automated scripts)
@@ -1599,7 +1600,8 @@ let internal_commands ~itn_features logger = | |||
let open Deferred.Let_syntax in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants_with_logging ~logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No-op change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we want logging on for this component (assuming internal commands aren't used in automated scripts)
@@ -1656,7 +1658,8 @@ let internal_commands ~itn_features logger = | |||
let open Async in | |||
let%bind constraint_constants, proof_level, compile_config = | |||
let%map conf = | |||
Runtime_config.Constants.load_constants ~logger config_file | |||
Runtime_config.Constants.load_constants_with_logging ~logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No-op change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we want logging on for this component (assuming internal commands aren't used in automated scripts)
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_files | ||
in | ||
let%map conf = Runtime_config.Constants.load_constants config_files in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we don't want logging on for this component (CLI utility)
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_files | ||
in | ||
let%map conf = Runtime_config.Constants.load_constants config_files in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we don't want logging on for this component (CLI utility)
@@ -1870,7 +1864,7 @@ let compile_time_constants = | |||
let%map ({ consensus_constants; _ } as precomputed_values), _ = | |||
(* This is kind of ugly because we are allowing for supplying a runtime_config value directly, rather than force what is read from the environment *) | |||
(* TODO: See if we can initialize consensus_constants without also initializing the ledger *) | |||
let logger = Logger.create () in | |||
let logger = Logger.null () in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we don't want logging on for this component (CLI utility)
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_files | ||
in | ||
let%map conf = Runtime_config.Constants.load_constants config_files in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we don't want logging on for this component (CLI utility)
let%map conf = | ||
Runtime_config.Constants.load_constants ~logger config_files | ||
Runtime_config.Constants.load_constants_with_logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm that we want logging for this test utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crypto changes LGTM
PR does a number of things:
~logger
parameter fromload_constants
, while adding a newload_constants_with_logging
function for the cases where logging is actually requiredload_constants
appear in the diff and decision on whether to use the logging is made explicitly on a case-by-case basis within this PR?logger
parameter fromload_compile_config
load_compile_config
explicitlyload_compile_config
function was introduced in [Part 1 of 2] Constants loader and Config loader #16186 (or predecessors) after adding an optional--config-file
parameter to commands inclient.ml
, use ofLogger.create ()
as a default logger was a mistake, which was already fixed in fix compile config logging #16381Logger.create ()
withLogger.null ()
in a single occasion ofload_config_files
being used directly for a CLI command that is expected to produce a short output with a result (mina advanced compile-time-constants
)