Baker: improve logging

This commit is contained in:
Vincent Botbol 2018-09-25 16:40:30 +02:00 committed by Grégoire Henry
parent 34b1ef3720
commit 31d207f52e
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2
3 changed files with 11 additions and 6 deletions

View File

@ -836,7 +836,7 @@ let bake (cctxt : #Proto_alpha.full) state =
~shell_header ~priority ?seed_nonce_hash ~src_sk operations ~shell_header ~priority ?seed_nonce_hash ~src_sk operations
|> trace_exn (Failure "Error while injecting block") >>=? fun block_hash -> |> trace_exn (Failure "Error while injecting block") >>=? fun block_hash ->
lwt_log_info Tag.DSL.(fun f -> lwt_log_notice Tag.DSL.(fun f ->
f "Injected block %a for %s after %a (level %a, priority %d, fitness %a, operations %a)." f "Injected block %a for %s after %a (level %a, priority %d, fitness %a, operations %a)."
-% t event "injected_block" -% t event "injected_block"
-% a Block_hash.Logging.tag block_hash -% a Block_hash.Logging.tag block_hash
@ -906,7 +906,7 @@ let compute_best_slot_on_current_level
let level = Raw_level.succ new_head.Client_baking_blocks.level in let level = Raw_level.succ new_head.Client_baking_blocks.level in
get_baking_slots cctxt ?max_priority new_head delegates >>= function get_baking_slots cctxt ?max_priority new_head delegates >>= function
| [] -> | [] ->
lwt_log_info Tag.DSL.(fun f -> lwt_log_notice Tag.DSL.(fun f ->
let max_priority = Option.unopt ~default:default_max_priority max_priority in let max_priority = Option.unopt ~default:default_max_priority max_priority in
f "No slot found at level %a (max_priority = %d)" f "No slot found at level %a (max_priority = %d)"
-% t event "no_slot_found" -% t event "no_slot_found"
@ -923,7 +923,7 @@ let compute_best_slot_on_current_level
) h t ) h t
in in
Client_keys.Public_key_hash.name cctxt delegate >>=? fun name -> Client_keys.Public_key_hash.name cctxt delegate >>=? fun name ->
lwt_log_info Tag.DSL.(fun f -> lwt_log_notice Tag.DSL.(fun f ->
f "New baking slot found (level %a, priority %d) at %a for %s after %a." f "New baking slot found (level %a, priority %d) at %a for %s after %a."
-% t event "have_baking_slot" -% t event "have_baking_slot"
-% a level_tag level -% a level_tag level

View File

@ -45,7 +45,7 @@ let forge_seed_nonce_revelation
Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash ->
match nonces with match nonces with
| [] -> | [] ->
lwt_log_info Tag.DSL.(fun f -> lwt_log_notice Tag.DSL.(fun f ->
f "Nothing to reveal for block %a" f "Nothing to reveal for block %a"
-% t event "no_nonce_reveal" -% t event "no_nonce_reveal"
-% a Block_hash.Logging.tag hash -% a Block_hash.Logging.tag hash

View File

@ -25,9 +25,11 @@
let await_bootstrapped_node (cctxt: #Proto_alpha.full) = let await_bootstrapped_node (cctxt: #Proto_alpha.full) =
(* Waiting for the node to be synchronized *) (* Waiting for the node to be synchronized *)
cctxt#message "Waiting for the node to be synchronized with the its \ cctxt#message "Waiting for the node to be synchronized with its \
peers..." >>= fun () -> peers..." >>= fun () ->
Shell_services.Monitor.bootstrapped cctxt Shell_services.Monitor.bootstrapped cctxt >>=? fun _ ->
cctxt#message "Node synchronized." >>= fun () ->
return_unit
module Endorser = struct module Endorser = struct
@ -36,6 +38,7 @@ module Endorser = struct
Client_baking_blocks.monitor_heads Client_baking_blocks.monitor_heads
~next_protocols:(Some [Proto_alpha.hash]) ~next_protocols:(Some [Proto_alpha.hash])
cctxt `Main >>=? fun block_stream -> cctxt `Main >>=? fun block_stream ->
cctxt#message "Endorser started." >>= fun () ->
Client_baking_endorsement.create cctxt ~delay delegates block_stream >>=? fun () -> Client_baking_endorsement.create cctxt ~delay delegates block_stream >>=? fun () ->
ignore min_date; ignore min_date;
return_unit return_unit
@ -56,6 +59,7 @@ module Baker = struct
Client_baking_blocks.monitor_heads Client_baking_blocks.monitor_heads
~next_protocols:(Some [Proto_alpha.hash]) ~next_protocols:(Some [Proto_alpha.hash])
cctxt `Main >>=? fun block_stream -> cctxt `Main >>=? fun block_stream ->
cctxt#message "Baker started." >>= fun () ->
Client_baking_forge.create cctxt Client_baking_forge.create cctxt
?fee_threshold ?max_priority ~max_waiting_time ~context_path delegates block_stream >>=? fun () -> ?fee_threshold ?max_priority ~max_waiting_time ~context_path delegates block_stream >>=? fun () ->
ignore min_date; ignore min_date;
@ -70,6 +74,7 @@ module Accuser = struct
Client_baking_blocks.monitor_valid_blocks Client_baking_blocks.monitor_valid_blocks
~next_protocols:(Some [Proto_alpha.hash]) ~next_protocols:(Some [Proto_alpha.hash])
cctxt ~chains:[ `Main ] () >>=? fun valid_blocks_stream -> cctxt ~chains:[ `Main ] () >>=? fun valid_blocks_stream ->
cctxt#message "Accuser started." >>= fun () ->
Client_baking_denunciation.create cctxt ~preserved_levels valid_blocks_stream >>=? fun () -> Client_baking_denunciation.create cctxt ~preserved_levels valid_blocks_stream >>=? fun () ->
return_unit return_unit