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

EKG counter for tips served #3300

Merged
merged 1 commit into from
Oct 20, 2021
Merged

EKG counter for tips served #3300

merged 1 commit into from
Oct 20, 2021

Conversation

karknu
Copy link
Contributor

@karknu karknu commented Oct 19, 2021

Add an EKG counter, cardano.node.metrics.served.block.latest.count, which
can be used to track how usefull the node is to its down stream peers.

This counter can be used as follows rate(cardano_node_metrics_served_block_latest_count_int[1h])/rate(cardano_node_metrics_blockNum_int[1h]) . Which gives a value close to 0 for unpopular node. And a value around 1 or more for a very useful node.

@karknu karknu marked this pull request as ready for review October 19, 2021 10:13
let mSlotNo = case pointSlot p of
Origin -> Nothing
At slotNo -> Just slotNo

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't seem necessary to transform one maybe type into another one. A few lines below we pattern match on mSlotNo, equally well we can just pattern match on pointSlot p.

case compare maxSlotNo slotNo of
LT -> do
STM.writeTVar tMaxSlotNo slotNo
lu <- STM.modifyReadTVar' tLocalUp (+1)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is modifyReadTVar'?

Is it equialvent to:

STM.modifyTVar' tLocalUP (+1) >> STM.readTVar tLocalUP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EQ -> do
lu <- STM.modifyReadTVar' tLocalUp (+1)
return (served, Just lu)
sendEKGDirectInt ekgDirect
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an empty line above.

traceBlockFetchServerMetrics (Just ekgDirect) tBlocksServed tLocalUp tMaxSlotNo tracer = Tracer bsTracer

where
bsTracer :: TraceBlockFetchServerEvent blk -> IO ()
Copy link
Contributor

Choose a reason for hiding this comment

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

This adds the local upstreaminess metric which tries to answer the question: how many times we serve a block which slot is either equal or ahead of last served block.

I would like to see a description how this related to the upstreaminess metric that is used to choose peers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should mention that at all. This is a useful metric on its own, regardless of if that is how down stream peers may judge the node in the future.

Add an EKG counter, cardano.node.metrics.served.block.latest.coun, which
can be used to track how usefull the node is to its down stream peers.
@karknu
Copy link
Contributor Author

karknu commented Oct 20, 2021

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 20, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 70e523c into master Oct 20, 2021
@iohk-bors iohk-bors bot deleted the karknu/tips_served branch October 20, 2021 20:11
@dorin100
Copy link

dorin100 commented Nov 8, 2021

more useful details for this new metric:

A value of 0 means that no one is fetching blocks from your relay.
A value of 1 means that for every new block forged someone is fetching it.
Above 2 means that for every block forged two nodes are fetching that block from you

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.

4 participants