Skip to content

Commit 478df21

Browse files
committed
GSM: add metric for the GSM state
Encoded as a number
1 parent e87337c commit 478df21

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,17 @@ instance ( LogFormatting selection
20952095

20962096
forHuman = showT
20972097

2098+
asMetrics =
2099+
\case
2100+
GsmEventEnterCaughtUp {} -> [caughtUp]
2101+
GsmEventLeaveCaughtUp {} -> [preSyncing]
2102+
GsmEventPreSyncingToSyncing {} -> [syncing]
2103+
GsmEventSyncingToPreSyncing {} -> [preSyncing]
2104+
where
2105+
preSyncing = IntM "GSM.state" 0
2106+
syncing = IntM "GSM.state" 1
2107+
caughtUp = IntM "GSM.state" 2
2108+
20982109
instance MetaTrace (TraceGsmEvent selection) where
20992110
namespaceFor =
21002111
\case
@@ -2125,6 +2136,19 @@ instance MetaTrace (TraceGsmEvent selection) where
21252136
Namespace _ _ ->
21262137
Nothing
21272138

2139+
metricsDocFor = \case
2140+
Namespace _ ["EnterCaughtUp"] -> doc
2141+
Namespace _ ["LeaveCaughtUp"] -> doc
2142+
Namespace _ ["PreSyncingToSyncing"] -> doc
2143+
Namespace _ ["SyncingToPreSyncing"] -> doc
2144+
Namespace _ _ -> []
2145+
where
2146+
doc =
2147+
[ ("GSM.state"
2148+
, "The state of the Genesis State Machine. 0 = PreSyncing, 1 = Syncing, 2 = CaughtUp."
2149+
)
2150+
]
2151+
21282152
allNamespaces =
21292153
[ Namespace [] ["EnterCaughtUp"]
21302154
, Namespace [] ["LeaveCaughtUp"]

0 commit comments

Comments
 (0)