Skip to content

Commit

Permalink
Remove use of multiline literals from trace-dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Feb 16, 2023
1 parent d4d97f7 commit 6613614
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 39 deletions.
65 changes: 35 additions & 30 deletions trace-dispatcher/examples/Examples/TestObjects.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,36 @@ instance MetaTrace (TraceForgeEvent blk) where
"Start of the leadership check\n\
\\n\
\We record the current slot number."
documentFor (Namespace _ ["SlotIsImmutable"]) = Just
"Leadership check failed: the tip of the ImmutableDB inhabits the\n\
\current slot\n\
\\n\
\This might happen in two cases.\n\
\\n\
\1. the clock moved backwards, on restart we ignored everything from the\n\
\ VolatileDB since it's all in the future, and now the tip of the\n\
\ ImmutableDB points to a block produced in the same slot we're trying\n\
\ to produce a block in\n\
\\n\
\2. k = 0 and we already adopted a block from another leader of the same\n\
\ slot.\n\
\\n\
\We record both the current slot number as well as the tip of the\n\
\ImmutableDB.\n\
\\n\
\See also <https://github.com/input-output-hk/ouroboros-network/issues/1462>"
documentFor (Namespace _ ["BlockFromFuture"]) = Just
"Leadership check failed: the current chain contains a block from a slot\n\
\/after/ the current slot\n\
\\n\
\This can only happen if the system is under heavy load.\n\
\\n\
\We record both the current slot number as well as the slot number of the\n\
\block at the tip of the chain.\n\
\\n\
\See also <https://github.com/input-output-hk/ouroboros-network/issues/1462>"
documentFor (Namespace _ ["SlotIsImmutable"]) = Just $ mconcat
[ "Leadership check failed: the tip of the ImmutableDB inhabits the\n"
, "current slot\n"
, "\n"
, "This might happen in two cases.\n"
, "\n"
, "1. the clock moved backwards, on restart we ignored everything from the\n"
, " VolatileDB since it's all in the future, and now the tip of the\n"
, " ImmutableDB points to a block produced in the same slot we're trying\n"
, " to produce a block in\n"
, "\n"
, "2. k = 0 and we already adopted a block from another leader of the same\n"
, " slot.\n"
, "\n"
, "We record both the current slot number as well as the tip of the\n"
, "ImmutableDB.\n"
, "\n"
, "See also <https://github.com/input-output-hk/ouroboros-network/issues/1462>"
]
documentFor (Namespace _ ["BlockFromFuture"]) = Just $ mconcat
[ "Leadership check failed: the current chain contains a block from a slot\n"
, "/after/ the current slot\n"
, "\n"
, "This can only happen if the system is under heavy load.\n"
, "\n"
, "We record both the current slot number as well as the slot number of the\n"
, "block at the tip of the chain.\n"
, "\n"
, "See also <https://github.com/input-output-hk/ouroboros-network/issues/1462>"
]
documentFor _ns = Nothing
metricsDocFor (Namespace _ _) = []
allNamespaces = [ Namespace [] ["StartLeadershipCheck"]
Expand All @@ -153,8 +155,11 @@ instance LogFormatting (TraceForgeEvent LogBlock) where
(unSlotNo slotNo)
forHuman (TraceSlotIsImmutable slotNo immutableTipPoint immutableTipBlkNo) = pack $
printf
"Couldn't forge block because slot %u is immutable. \
\ Immutable tip: %s, immutable tip block no: %i."
( mconcat
[ "Couldn't forge block because slot %u is immutable. "
, " Immutable tip: %s, immutable tip block no: %i."
]
)
(unSlotNo slotNo)
(show immutableTipPoint)
(unBlockNo immutableTipBlkNo)
Expand Down
21 changes: 12 additions & 9 deletions trace-dispatcher/src/Cardano/Logging/TraceDispatcherMessage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,18 @@ instance MetaTrace TraceDispatcherMessage where

documentFor (Namespace _ ["StartLimiting"]) = Just
"This message indicates the start of frequency limiting"
documentFor (Namespace _ ["StopLimiting"]) = Just
"This message indicates the stop of frequency limiting,\
\ and gives the number of messages that has been suppressed"
documentFor (Namespace _ ["RememberLimiting"]) = Just
"^ This message remembers of ongoing frequency limiting,\
\ and gives the number of messages that has been suppressed"
documentFor (Namespace _ ["UnknownNamespace"]) = Just
"A value was queried for a namespaces from a tracer,\
\which is unknown. This inicates a bug in the tracer implementation."
documentFor (Namespace _ ["StopLimiting"]) = Just $ mconcat
[ "This message indicates the stop of frequency limiting,"
, " and gives the number of messages that has been suppressed"
]
documentFor (Namespace _ ["RememberLimiting"]) = Just $ mconcat
[ "^ This message remembers of ongoing frequency limiting,"
, " and gives the number of messages that has been suppressed"
]
documentFor (Namespace _ ["UnknownNamespace"]) = Just $ mconcat
[ "A value was queried for a namespaces from a tracer,"
, "which is unknown. This inicates a bug in the tracer implementation."
]

allNamespaces = [
Namespace [] ["StartLimiting"]
Expand Down

0 comments on commit 6613614

Please sign in to comment.