Skip to content
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

Add logger to FollowerState #4156

Merged
merged 1 commit into from
Apr 5, 2023
Merged

Add logger to FollowerState #4156

merged 1 commit into from
Apr 5, 2023

Conversation

janezpodhostnik
Copy link
Contributor

Extracting pieces from #3736 so its easier to digest and merge.

This one adds a currently unused log to follower state, to be used in the next PR.

Copy link
Member

@durkmurder durkmurder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I would suggest is to change logger to be the first argument, in many places we try to pass it as first argument, using automatic refactoring it could be done very easily.

@janezpodhostnik janezpodhostnik force-pushed the janez/storage-layer-test-refactor branch from cf86037 to 440c9a6 Compare April 4, 2023 17:02
consensus/integration/nodes_test.go Outdated Show resolved Hide resolved
@janezpodhostnik janezpodhostnik force-pushed the janez/add-log-to-follower-state branch from 9a911c8 to 2a8e425 Compare April 4, 2023 17:06
@janezpodhostnik
Copy link
Contributor Author

@durkmurder I feel like the tracer and the logger belong together contextually. I think it would make sense moving the tracer as well then:

// state. This implementation is suitable only for NON-Consensus nodes.
func NewFollowerState(
	logger zerolog.Logger,
	tracer module.Tracer,
	state *State,
	index storage.Index,
	payloads storage.Payloads,
	consumer protocol.Consumer,
	blockTimer protocol.BlockTimer,
) (*FollowerState, error) 

what do you think?

@durkmurder
Copy link
Member

@durkmurder I feel like the tracer and the logger belong together contextually. I think it would make sense moving the tracer as well then:


// state. This implementation is suitable only for NON-Consensus nodes.

func NewFollowerState(

	logger zerolog.Logger,

	tracer module.Tracer,

	state *State,

	index storage.Index,

	payloads storage.Payloads,

	consumer protocol.Consumer,

	blockTimer protocol.BlockTimer,

) (*FollowerState, error) 

what do you think?

Yup, you could also move consumer as well, also attaching example where logger, consumers, metrics, trading are grouped together and later other dependencies

@janezpodhostnik janezpodhostnik force-pushed the janez/storage-layer-test-refactor branch from 440c9a6 to 52c46c8 Compare April 4, 2023 18:07
Base automatically changed from janez/storage-layer-test-refactor to master April 4, 2023 19:15
@janezpodhostnik janezpodhostnik force-pushed the janez/add-log-to-follower-state branch from 2a8e425 to 31510b6 Compare April 4, 2023 19:40
@janezpodhostnik janezpodhostnik force-pushed the janez/add-log-to-follower-state branch from 31510b6 to d8ed58c Compare April 4, 2023 19:41
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2023

Codecov Report

Merging #4156 (d8ed58c) into master (52c46c8) will increase coverage by 2.38%.
The diff coverage is 35.71%.

@@            Coverage Diff             @@
##           master    #4156      +/-   ##
==========================================
+ Coverage   51.09%   53.48%   +2.38%     
==========================================
  Files         674      837     +163     
  Lines       60522    78472   +17950     
==========================================
+ Hits        30924    41967   +11043     
- Misses      27118    33152    +6034     
- Partials     2480     3353     +873     
Flag Coverage Δ
unittests 53.48% <35.71%> (+2.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/execution_builder.go 0.00% <0.00%> (ø)
cmd/verification_builder.go 0.00% <0.00%> (ø)
state/protocol/badger/mutator.go 66.66% <100.00%> (+0.46%) ⬆️

... and 166 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@durkmurder durkmurder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@janezpodhostnik
Copy link
Contributor Author

bors merge

@bors bors bot merged commit 8ce7cb1 into master Apr 5, 2023
@bors bors bot deleted the janez/add-log-to-follower-state branch April 5, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants