-
Notifications
You must be signed in to change notification settings - Fork 87
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
LocalTxMonitor: Add support for GetMeasures #4918
base: main
Are you sure you want to change the base?
Conversation
d45e534
to
7398881
Compare
ouroboros-network-protocols/src/Ouroboros/Network/Protocol/LocalTxMonitor/Type.hs
Outdated
Show resolved
Hide resolved
9488451
to
d6eb7bb
Compare
d6eb7bb
to
0a00293
Compare
1007422
to
e415888
Compare
MsgReplyGetMeasures measures -> | ||
CBOR.encodeListLen 2 | ||
<> CBOR.encodeWord 12 | ||
<> CBOR.encodeListLen 2 | ||
<> CBOR.encodeWord32 (txCount measures) | ||
<> encodeMeasureMap (measuresMap measures) |
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?
MsgReplyGetMeasures measures -> | |
CBOR.encodeListLen 2 | |
<> CBOR.encodeWord 12 | |
<> CBOR.encodeListLen 2 | |
<> CBOR.encodeWord32 (txCount measures) | |
<> encodeMeasureMap (measuresMap measures) | |
MsgReplyGetMeasures measures -> | |
CBOR.encodeListLen 3 | |
<> CBOR.encodeWord 12 | |
<> CBOR.encodeWord32 (txCount measures) | |
<> encodeMeasureMap (measuresMap measures) |
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.
changed this, thanks!
f mn sc = | ||
encodeMeasureName mn <> encodeSizeAndCapacity sc |
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.
Shouldn't it be ⬇️ for it to produce valid CBOR?
f mn sc = | |
encodeMeasureName mn <> encodeSizeAndCapacity sc | |
f mn sc = | |
encodeListLen 2 | |
<> encodeMeasureName mn | |
<> encodeSizeAndCapacity sc |
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.
am I misunderstanding how CBOR's map encoding works? I was under the impression that they were encoded as a length N followed by N pairs of elements that constitute the map, which should be what this code is doing (?)
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.
the CDDL tests pass, which I wouldn't expect if the encoding were invalid
ouroboros-network-protocols/testlib/Ouroboros/Network/Protocol/LocalTxMonitor/Examples.hs
Outdated
Show resolved
Hide resolved
data TokBusyKind (k :: StBusyKind) where | ||
TokNextTx :: TokBusyKind NextTx | ||
TokHasTx :: TokBusyKind HasTx | ||
TokGetSizes :: TokBusyKind GetSizes | ||
TokNextTx :: TokBusyKind NextTx | ||
TokHasTx :: TokBusyKind HasTx | ||
TokGetSizes :: TokBusyKind GetSizes | ||
TokGetMeasures :: TokBusyKind GetMeasures |
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 have SingBusyKind
; I suspect TokBusyKind
is not needed at all (either I missed removing it, or it resurfaced after a rebase).
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.
yep, I was a little puzzled about this after the commit that changed the API -- I'm happy to remove it in this change though (unless that's a breaking change that would somehow cause downstream issues?)
…reName just a newtype around Text, so that network doesn't need to know about anything ledger-specific
…he new typed-protocols API
…gGetMeasures and MsgReplyGetMeasures
e415888
to
48b514c
Compare
Description
This PR adds a new message to
LocalTxMonitor
,GetMeasures
, which is similar toGetSize
(returning the current mempool transaction count, the size of those transactions, and the total mempool capacity), but returns information about several other metrics in addition to the byte size and capacity of the mempool.GetMeasures
currently returns size and capacity information for transaction byte size, ledger's execution units (both their memory and execution steps), and the reference scripts size, but can easily be extended to support any new metric types in future while remaining backwards compatible.This change works towards ouroboros-consensus#1178, and has a dependent PR in ouroboros-consensus
Checklist
Quality
Maintenance
ouroboros-network
project.