CDFs for EB announcements - #6639
Conversation
* Moved to a new module * Provide re-usable API This is a preparation work for re-using the CDF calculations for Leios.
|
|
||
| data Config = Config { numOfDataPoints :: Int } | ||
|
|
||
| -- | Default `Config` keeps `k/2` data points. |
There was a problem hiding this comment.
The proportionality to k is easier to justify for some CDFs than for others, but it's probably fine for most?
There was a problem hiding this comment.
But one other option is to just force each callers to choose a number
| -- ^ index, priority, value | ||
| -> State p | ||
| -> f Counter | ||
| -> (f Counter, State p, Bool) |
There was a problem hiding this comment.
A couple questions that a comment should answer:
- What does the
Boolmean? - Why do we need to maintain the
Counterand theStateas separate things?
There was a problem hiding this comment.
There's only two call sites to this function and they both ignore the return value when the returned Bool is False.
So return Maybe (f Counter, State p) instead?
| = if Pq.size m' > numOfDataPoints | ||
| then | ||
| case Pq.minView m' of | ||
| Nothing -> (cdfs, s, False) |
| where | ||
| nothingToDo = (cdfs, s, False) | ||
|
|
||
| delay_ :: Double |
There was a problem hiding this comment.
Just inline this as (realToFrac delay :: Double)?
| | otherwise = cdf | ||
|
|
||
|
|
||
| newtype State p = State { cdfState :: IntPSQ p NominalDiffTime } |
There was a problem hiding this comment.
Please add a comment explaining why a Cdf needs a notion of priority?
| data LeiosMetrics' c = LeiosMetrics { | ||
| lmCdfState :: Cdf.State SlotNo | ||
| -- ^ internal state which collects all data points | ||
| , lmSlotMapLate :: IntPSQ SlotNo () |
There was a problem hiding this comment.
Why isn't this just another c?
There was a problem hiding this comment.
And maybe (Maybe SlotNo, Int) would be a simpler data structure to understand?
| where | ||
| size = Cdf.size lmCdfState | ||
| cdfMetric name var = DoubleM name (fromIntegral (Cdf.counter var) / fromIntegral size) | ||
| lateAnnoucementsAllMetric = [ CounterM "leios.eb.announcement.late.all" Nothing | lmDelay > 2 ] |
There was a problem hiding this comment.
Typos:
lateAnnoucementsAllMetric->lateAnnoumcementsAllMetriclateAnnoucementsPerSlotMetric->lateAnnoucementsPerSlotMetric
|
|
||
| calculateLeiosMetrics lm _lc _ = lm | ||
|
|
||
| instance LogFormatting LeiosMetrics where |
There was a problem hiding this comment.
👍 matches
cardano-node/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs
Lines 535 to 552 in ee7ea74
| , ("leios.eb.announcement.delay.cdf1600ms", "probability for EB announcemement to complete within 1600ms") | ||
| , ("leios.eb.announcement.delay.cdf1800ms", "probability for EB announcemement to complete within 1800ms") | ||
| , ("leios.eb.announcement.delay.cdf2000ms", "probability for EB announcemement to complete within 2000ms") | ||
| , ("leios.e.b.announcement.late.all", "number of late EB announcements that took longer than 2s: all peers are included") |
There was a problem hiding this comment.
I wasn't expecting "all peers are included" here. These metrics are driven by TraceLeiosAnnouncementAccepted, which is deduped---it only fires the first time some announcement arrives.
| , ("leios.eb.announcement.delay.cdf1800ms", "probability for EB announcemement to complete within 1800ms") | ||
| , ("leios.eb.announcement.delay.cdf2000ms", "probability for EB announcemement to complete within 2000ms") | ||
| , ("leios.e.b.announcement.late.all", "number of late EB announcements that took longer than 2s: all peers are included") | ||
| , ("leios.e.b.announcement.late.bySlot", "number of slots for which the earliest EB announcements took longer than 2s") |
There was a problem hiding this comment.
It looks to me like lmSlotMapLate is counting announcements rather than counting slots. Am I confused?
There was a problem hiding this comment.
Overall, I'm not clear on what lmSlotMapLate is actually doing... partly because I'm not sure what IntM is, but if I recall correctly (I can't find its definition right now), it's a gauge, so it's not accumulating anything.
Description
Checklist
See Running tests for more details
CHANGELOG.mdfor affected packagecardano-node-chairman,cardano-submit-apiandcardano-testnetinstead need achangelog fragment in
<package>/.changes/, because theirCHANGELOG.mdis generatedfrom fragments at release time. Copy
_TEMPLATE.ymlfrom that directory, or runnix run github:input-output-hk/cardano-dev#herald -- new.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.