Skip to content

Align tracing severities among tracing systems #6171

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ instance MetaTrace (TraceForgeEvent blk) where
severityFor (Namespace _ ["LedgerState"]) _ = Just Debug
severityFor (Namespace _ ["NoLedgerView"]) _ = Just Error
severityFor (Namespace _ ["LedgerView"]) _ = Just Debug
severityFor (Namespace _ ["ForgeStateUpdateError"]) _ = Just Error
severityFor (Namespace _ ["ForgeStateUpdateError"]) _ = Just Critical
severityFor (Namespace _ ["NodeCannotForge"]) _ = Just Error
severityFor (Namespace _ ["NodeNotLeader"]) _ = Just Info
severityFor (Namespace _ ["NodeIsLeader"]) _ = Just Info
Expand All @@ -1826,6 +1826,9 @@ instance MetaTrace (TraceForgeEvent blk) where
severityFor (Namespace _ ["AdoptionThreadDied"]) _ = Just Error
severityFor _ _ = Nothing

privacyFor (Namespace _ ["ForgeStateUpdateError"]) _ = Just Confidential
privacyFor _ _ = Nothing

metricsDocFor (Namespace _ ["StartLeadershipCheck"]) =
[("Forge.about-to-lead", "")]
metricsDocFor (Namespace _ ["SlotIsImmutable"]) =
Expand Down
54 changes: 30 additions & 24 deletions cardano-node/src/Cardano/Tracing/Tracers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -842,22 +842,24 @@ mkConsensusTracers mbEKGDirect trSel verb tr nodeKern fStats = do
mkForgeTracers :: IO ForgeTracers
mkForgeTracers = do
-- We probably don't want to pay the extra IO cost per-counter-increment. -- sk
staticMeta <- mkLOMeta Critical Confidential
metaCritical <- mkLOMeta Critical Confidential
metaInfo <- mkLOMeta Info Public
metaError <- mkLOMeta Error Public
let name :: LoggerName = "metrics.Forge"
ForgeTracers
<$> counting (liftCounting staticMeta name "forged" tr)
<*> counting (liftCounting staticMeta name "forge-about-to-lead" tr)
<*> counting (liftCounting staticMeta name "could-not-forge" tr)
<*> counting (liftCounting staticMeta name "adopted" tr)
<*> counting (liftCounting staticMeta name "didnt-adopt" tr)
<*> counting (liftCounting staticMeta name "forged-invalid" tr)
<*> counting (liftCounting staticMeta name "node-not-leader" tr)
<*> counting (liftCounting staticMeta name "cannot-forge" tr)
<*> counting (liftCounting staticMeta name "forge-state-update-error" tr)
<*> counting (liftCounting staticMeta name "block-from-future" tr)
<*> counting (liftCounting staticMeta name "slot-is-immutable" tr)
<*> counting (liftCounting staticMeta name "node-is-leader" tr)
<*> counting (liftCounting staticMeta name "adoption-thread-died" tr)
<$> counting (liftCounting metaInfo name "forged" tr)
<*> counting (liftCounting metaInfo name "forge-about-to-lead" tr)
<*> counting (liftCounting metaError name "could-not-forge" tr)
<*> counting (liftCounting metaInfo name "adopted" tr)
<*> counting (liftCounting metaError name "didnt-adopt" tr)
<*> counting (liftCounting metaError name "forged-invalid" tr)
<*> counting (liftCounting metaInfo name "node-not-leader" tr)
<*> counting (liftCounting metaError name "cannot-forge" tr)
<*> counting (liftCounting metaCritical name "forge-state-update-error" tr)
<*> counting (liftCounting metaError name "block-from-future" tr)
<*> counting (liftCounting metaError name "slot-is-immutable" tr)
<*> counting (liftCounting metaInfo name "node-is-leader" tr)
<*> counting (liftCounting metaError name "adoption-thread-died" tr)

traceServedCount :: Maybe EKGDirect -> TraceChainSyncServerEvent blk -> IO ()
traceServedCount Nothing _ = pure ()
Expand Down Expand Up @@ -1369,21 +1371,25 @@ forgeStateInfoMetricsTraceTransformer p tr = Tracer $
$ fromIntegral kesPeriodsUntilExpiry
]

meta <- mkLOMeta Critical Confidential
mapM_ (traceNamedObject metricsTr . (meta,)) logValues
metaInfo <- mkLOMeta Info Public
mapM_ (traceNamedObject metricsTr . (metaInfo,)) logValues

-- Trace warning messages on the last 7 KES periods and, in the
-- final and subsequent KES periods, trace alert messages.
metaWarning <- mkLOMeta Warning Public
metaAlert <- mkLOMeta Alert Public
when (kesPeriodsUntilExpiry <= 7) $
traceWith tr
( mempty
, LogObject
mempty
(if kesPeriodsUntilExpiry <= 1 then metaAlert else metaWarning)
(LogStructuredText mempty (expiryLogMessage kesPeriodsUntilExpiry))
)
traceWith tr
( mempty
, LogObject
mempty
(if kesPeriodsUntilExpiry > 7
then metaInfo
else if kesPeriodsUntilExpiry > 1
then metaWarning
else metaAlert
)
(LogStructuredText mempty (expiryLogMessage kesPeriodsUntilExpiry))
)
where
expiryLogMessage :: Word -> Text
expiryLogMessage kesPeriodsUntilExpiry =
Expand Down
Loading