-
Notifications
You must be signed in to change notification settings - Fork 721
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
CAD-1131: add a UTxO size trace to TraceStartLeadershipCheck messages & lots of cleanups #1329
Conversation
5cc1b15
to
e1fdcfa
Compare
@@ -465,7 +478,7 @@ mkConsensusTracers' elidingFetchDecision measureBlockForging | |||
tracingVerbosity :: TracingVerbosity | |||
tracingVerbosity = traceVerbosity traceConf | |||
|
|||
mkConsensusTracers' _ _ _ _ TracingOff _ = Consensus.Tracers | |||
mkConsensusTracers' _ _ _ _ _ TracingOff _ = Consensus.Tracers |
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.
Surely there is a less horrible way to do that?
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.
That would take a refactor, and people complain about large changes -- making them hard to review.
I already took some risks with this one..
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.
Suggestion: fix it in a separate commit (before the other changes)?
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.
@mrBliss, done!
I didn't clean up all things I could, but that's already a large change.
We have quite a huge mess there..
e1fdcfa
to
657f2f6
Compare
import Data.IORef (IORef, atomicModifyIORef', readIORef) | ||
import qualified Data.Text as Text | ||
import qualified Data.HashMap.Strict as Map |
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.
Why not an ordered Map
like everywhere else?
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.
We're creating an Aeson object manually, which uses this HashMap type under the hood.
|
||
|
||
class LedgerQueries blk where | ||
ledgerUtxoSize :: LedgerState blk -> Int |
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 have seen UTxO
(vs. Utxo
) in a few places, although Utxo
follows Haskell's capitalisation rules better.
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.
Yes, that was one the unstated questions I had, actually, thank you!
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.
So, Thomas, if you think we should change it, I'd need a slightly less subtle suggestion. : -)
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 the record, ledger code uses:
UTXO
UTxO
Utxo
utxo
|
||
newtype NodeKernelData blk = | ||
NodeKernelData | ||
{ unNodeKernelData :: IORef (SMaybe (NodeKernel IO RemoteConnectionId LocalConnectionId blk)) |
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 IORef
will only be filled in once, when the NodeKernel
has started (I know that was already the case before this PR), so that IORef
+ SMaybe
is only used to break the circular dependency right?
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.
Yes, the tracers have to be created to make NodeKernel
available.
@@ -465,7 +478,7 @@ mkConsensusTracers' elidingFetchDecision measureBlockForging | |||
tracingVerbosity :: TracingVerbosity | |||
tracingVerbosity = traceVerbosity traceConf | |||
|
|||
mkConsensusTracers' _ _ _ _ TracingOff _ = Consensus.Tracers | |||
mkConsensusTracers' _ _ _ _ _ TracingOff _ = Consensus.Tracers |
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.
Suggestion: fix it in a separate commit (before the other changes)?
7ae573b
to
1113e36
Compare
073a981
to
a1436ec
Compare
aaca4a1
to
0b0271a
Compare
0b0271a
to
aa763bd
Compare
aa763bd
to
ac3467a
Compare
ac3467a
to
70d0c88
Compare
bors r+ |
1329: CAD-1131: add a UTxO size trace to TraceStartLeadershipCheck messages & lots of cleanups r=deepfire a=deepfire 1. Factors the `Cardano.Tracing.Kernel` module for `NodeKernel` access. 2. `Cardano.Config.LedgerQuery` for a ledger queries typeclass. 3. Enhance the `TraceStartLeadershipCheck` message with a UTxO size value. 4. Switch over to the newly available `Shelley.Spec.Ledger.BaseTypes.StrictMaybe`. 5. Clean up the overall tracer setup somewhat. Sample messages: ``` {"at":"2020-06-23T22:30:54.43Z","env":"1.14.0:00000","ns":["cardano.node.Forge"],"data":{"kind":"TraceStartLeadershipCheck","slot":0},"app":[],"msg":"","pid":"12379","loc":null,"host":"andromed","sev":"Info","thread":"37"} {"at":"2020-06-23T22:30:54.63Z","env":"1.14.0:00000","ns":["cardano.node.Forge"],"data":{"kind":"TraceStartLeadershipCheck","slot":1,"utxoSize":3},"app":[],"msg":"","pid":"12379","loc":null,"host":"andromed","sev":"Info","thread":"37"} ``` Note the absence of `utxoSize` for slot 0, when there's no `NodeKernel` available yet. Co-authored-by: Kosyrev Serge <kosyrev.serge@protonmail.com>
Build failed |
bors r+ |
Build succeeded |
Cardano.Tracing.Kernel
module forNodeKernel
access.Cardano.Config.LedgerQuery
for a ledger queries typeclass.TraceStartLeadershipCheck
message with a UTxO size value.Shelley.Spec.Ledger.BaseTypes.StrictMaybe
.Sample messages:
Note the absence of
utxoSize
for slot 0, when there's noNodeKernel
available yet.