Skip to content

Commit 61f97b0

Browse files
committed
tracing: new implementations in ouroboros-network:tracing
Fix for "Pattern match(es) are non-exhaustive"
1 parent bc2e814 commit 61f97b0

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

ouroboros-network/tracing/Ouroboros/Network/Tracing/PeerSelection/Governor/TracePeerSelection.hs

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -432,21 +432,13 @@ instance ( Ord ntnAddr
432432
, "upstreamyness" .= dpssUpstreamyness ds
433433
, "fetchynessBlocks" .= dpssFetchynessBlocks ds
434434
]
435-
{-- TODO:
436-
Pattern match(es) are non-exhaustive
437-
In an equation for ‘forMachine’:
438-
Patterns of type ‘DetailLevel’,
439-
‘TracePeerSelection
440-
extraDebugState
441-
extraFlags
442-
extraPeers
443-
extraTrace
444-
ntnAddr’ not matched:
445-
_ (ExtraTrace _)
446-
|
447-
107 | forMachine _dtal (TraceLocalRootPeersChanged lrp lrp') =
448-
--}
449-
forMachine _ _ = mempty
435+
{-- TODO: Implementation for `ExtraTrace` was added here but it's not present
436+
-- in cardano-node master.
437+
--}
438+
forMachine _dtal (ExtraTrace tr) =
439+
mconcat [ "kind" .= String "ExtraTrace"
440+
, "event" .= String (pack $ show tr)
441+
]
450442

451443
forHuman = pack . show
452444

@@ -586,21 +578,8 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers ext
586578
Namespace [] ["ChurnTimeout"]
587579
namespaceFor TraceDebugState {} =
588580
Namespace [] ["DebugState"]
589-
{-- TODO:
590-
> Pattern match(es) are non-exhaustive
591-
> In an equation for ‘namespaceFor’:
592-
> Patterns of type ‘TracePeerSelection
593-
> extraDebugState
594-
> extraFlags
595-
> extraPeers
596-
> extraTrace
597-
> SockAddr’ not matched:
598-
> ExtraTrace _
599-
> |
600-
> 467 | namespaceFor TraceLocalRootPeersChanged {} =
601-
--}
602-
namespaceFor _ =
603-
Namespace [] []
581+
namespaceFor (ExtraTrace _) =
582+
Namespace [] ["ExtraTrace"]
604583

605584
severityFor (Namespace [] ["LocalRootPeersChanged"]) _ = Just Notice
606585
severityFor (Namespace [] ["TargetsChanged"]) _ = Just Notice
@@ -663,6 +642,7 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers ext
663642
severityFor (Namespace [] ["ChurnAction"]) _ = Just Info
664643
severityFor (Namespace [] ["ChurnTimeout"]) _ = Just Notice
665644
severityFor (Namespace [] ["DebugState"]) _ = Just Info
645+
severityFor (Namespace [] ["ExtraTrace"]) _ = Just Debug
666646
severityFor _ _ = Nothing
667647

668648
documentFor (Namespace [] ["LocalRootPeersChanged"]) = Just ""
@@ -728,8 +708,10 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers ext
728708
"Outbound Governor was killed unexpectedly"
729709
documentFor (Namespace [] ["DebugState"]) = Just
730710
"peer selection internal state"
731-
documentFor (Namespace [] ["VerifyPeerSnapshot"]) = Just
732-
"Verification outcome of big ledger peer snapshot"
711+
{-- TODO: Implementation for `ExtraTrace` was added here but it's not present
712+
-- in cardano-node master.
713+
--}
714+
documentFor (Namespace [] ["ExtraTrace"]) = Just ""
733715
documentFor _ = Nothing
734716

735717
metricsDocFor (Namespace [] ["ChurnAction"]) =
@@ -804,5 +786,6 @@ instance MetaTrace (TracePeerSelection extraDebugState extraFlags extraPeers ext
804786
, Namespace [] ["VerifyPeerSnapshot"]
805787
, Namespace [] ["OutboundGovernorCriticalFailure"]
806788
, Namespace [] ["DebugState"]
789+
, Namespace [] ["ExtraTrace"]
807790
]
808791

0 commit comments

Comments
 (0)