@@ -12,8 +12,7 @@ module Cardano.Node.Tracing.Tracers.NodeToClient () where
1212
1313import Cardano.Logging
1414import Ouroboros.Consensus.Ledger.Query (Query )
15- import qualified Ouroboros.Network.Driver.Simple as Simple
16- import qualified Ouroboros.Network.Driver.Stateful as Stateful
15+ import Ouroboros.Network.Logging.Framework ()
1716import Ouroboros.Network.Protocol.ChainSync.Type as ChainSync
1817import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as LSQ
1918import qualified Ouroboros.Network.Protocol.LocalTxMonitor.Type as LTM
@@ -26,139 +25,6 @@ import qualified Network.TypedProtocol.Stateful.Codec as Stateful
2625
2726{-# ANN module ("HLint: ignore Redundant bracket" :: Text) #-}
2827
29- instance LogFormatting (Simple. AnyMessage ps )
30- => LogFormatting (Simple. TraceSendRecv ps ) where
31- forMachine dtal (Simple. TraceSendMsg m) = mconcat
32- [ " kind" .= String " Send" , " msg" .= forMachine dtal m ]
33- forMachine dtal (Simple. TraceRecvMsg m) = mconcat
34- [ " kind" .= String " Recv" , " msg" .= forMachine dtal m ]
35-
36- forHuman (Simple. TraceSendMsg m) = " Send: " <> forHumanOrMachine m
37- forHuman (Simple. TraceRecvMsg m) = " Receive: " <> forHumanOrMachine m
38-
39- asMetrics (Simple. TraceSendMsg m) = asMetrics m
40- asMetrics (Simple. TraceRecvMsg m) = asMetrics m
41-
42- instance LogFormatting (Stateful. AnyMessage ps f )
43- => LogFormatting (Stateful. TraceSendRecv ps f ) where
44- forMachine dtal (Stateful. TraceSendMsg m) = mconcat
45- [ " kind" .= String " Send" , " msg" .= forMachine dtal m ]
46- forMachine dtal (Stateful. TraceRecvMsg m) = mconcat
47- [ " kind" .= String " Recv" , " msg" .= forMachine dtal m ]
48-
49- forHuman (Stateful. TraceSendMsg m) = " Send: " <> forHumanOrMachine m
50- forHuman (Stateful. TraceRecvMsg m) = " Receive: " <> forHumanOrMachine m
51-
52- asMetrics (Stateful. TraceSendMsg m) = asMetrics m
53- asMetrics (Stateful. TraceRecvMsg m) = asMetrics m
54-
55- instance MetaTrace (Simple. AnyMessage ps ) =>
56- MetaTrace (Simple. TraceSendRecv ps ) where
57- namespaceFor (Simple. TraceSendMsg msg) =
58- nsPrependInner " Send" (namespaceFor msg)
59- namespaceFor (Simple. TraceRecvMsg msg) =
60- nsPrependInner " Receive" (namespaceFor msg)
61-
62- severityFor (Namespace out (" Send" : tl)) (Just (Simple. TraceSendMsg msg)) =
63- severityFor (Namespace out tl) (Just msg)
64- severityFor (Namespace out (" Send" : tl)) Nothing =
65- severityFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
66- severityFor (Namespace out (" Receive" : tl)) (Just (Simple. TraceSendMsg msg)) =
67- severityFor (Namespace out tl) (Just msg)
68- severityFor (Namespace out (" Receive" : tl)) Nothing =
69- severityFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
70- severityFor _ _ = Nothing
71-
72- privacyFor (Namespace out (" Send" : tl)) (Just (Simple. TraceSendMsg msg)) =
73- privacyFor (Namespace out tl) (Just msg)
74- privacyFor (Namespace out (" Send" : tl)) Nothing =
75- privacyFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
76- privacyFor (Namespace out (" Receive" : tl)) (Just (Simple. TraceSendMsg msg)) =
77- privacyFor (Namespace out tl) (Just msg)
78- privacyFor (Namespace out (" Receive" : tl)) Nothing =
79- privacyFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
80- privacyFor _ _ = Nothing
81-
82- detailsFor (Namespace out (" Send" : tl)) (Just (Simple. TraceSendMsg msg)) =
83- detailsFor (Namespace out tl) (Just msg)
84- detailsFor (Namespace out (" Send" : tl)) Nothing =
85- detailsFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
86- detailsFor (Namespace out (" Receive" : tl)) (Just (Simple. TraceSendMsg msg)) =
87- detailsFor (Namespace out tl) (Just msg)
88- detailsFor (Namespace out (" Receive" : tl)) Nothing =
89- detailsFor (Namespace out tl :: Namespace (Simple. AnyMessage ps )) Nothing
90- detailsFor _ _ = Nothing
91-
92- metricsDocFor (Namespace out (" Send" : tl)) =
93- metricsDocFor (nsCast (Namespace out tl) :: Namespace (Simple. AnyMessage ps ))
94- metricsDocFor (Namespace out (" Receive" : tl)) =
95- metricsDocFor (nsCast (Namespace out tl) :: Namespace (Simple. AnyMessage ps ))
96- metricsDocFor _ = []
97-
98- documentFor (Namespace out (" Send" : tl)) =
99- documentFor (nsCast (Namespace out tl) :: Namespace (Simple. AnyMessage ps ))
100- documentFor (Namespace out (" Receive" : tl)) =
101- documentFor (nsCast (Namespace out tl) :: Namespace (Simple. AnyMessage ps ))
102- documentFor _ = Nothing
103-
104- allNamespaces =
105- let cn = allNamespaces :: [Namespace (Simple. AnyMessage ps )]
106- in fmap (nsPrependInner " Send" ) cn ++ fmap (nsPrependInner " Receive" ) cn
107-
108- instance MetaTrace (Stateful. AnyMessage ps f ) =>
109- MetaTrace (Stateful. TraceSendRecv ps f ) where
110- namespaceFor (Stateful. TraceSendMsg msg) =
111- nsPrependInner " Send" (namespaceFor msg)
112- namespaceFor (Stateful. TraceRecvMsg msg) =
113- nsPrependInner " Receive" (namespaceFor msg)
114-
115- severityFor (Namespace out (" Send" : tl)) (Just (Stateful. TraceSendMsg msg)) =
116- severityFor (Namespace out tl) (Just msg)
117- severityFor (Namespace out (" Send" : tl)) Nothing =
118- severityFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
119- severityFor (Namespace out (" Receive" : tl)) (Just (Stateful. TraceSendMsg msg)) =
120- severityFor (Namespace out tl) (Just msg)
121- severityFor (Namespace out (" Receive" : tl)) Nothing =
122- severityFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
123- severityFor _ _ = Nothing
124-
125- privacyFor (Namespace out (" Send" : tl)) (Just (Stateful. TraceSendMsg msg)) =
126- privacyFor (Namespace out tl) (Just msg)
127- privacyFor (Namespace out (" Send" : tl)) Nothing =
128- privacyFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
129- privacyFor (Namespace out (" Receive" : tl)) (Just (Stateful. TraceSendMsg msg)) =
130- privacyFor (Namespace out tl) (Just msg)
131- privacyFor (Namespace out (" Receive" : tl)) Nothing =
132- privacyFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
133- privacyFor _ _ = Nothing
134-
135- detailsFor (Namespace out (" Send" : tl)) (Just (Stateful. TraceSendMsg msg)) =
136- detailsFor (Namespace out tl) (Just msg)
137- detailsFor (Namespace out (" Send" : tl)) Nothing =
138- detailsFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
139- detailsFor (Namespace out (" Receive" : tl)) (Just (Stateful. TraceSendMsg msg)) =
140- detailsFor (Namespace out tl) (Just msg)
141- detailsFor (Namespace out (" Receive" : tl)) Nothing =
142- detailsFor (Namespace out tl :: Namespace (Stateful. AnyMessage ps f )) Nothing
143- detailsFor _ _ = Nothing
144-
145- metricsDocFor (Namespace out (" Send" : tl)) =
146- metricsDocFor (nsCast (Namespace out tl) :: Namespace (Stateful. AnyMessage ps f ))
147- metricsDocFor (Namespace out (" Receive" : tl)) =
148- metricsDocFor (nsCast (Namespace out tl) :: Namespace (Stateful. AnyMessage ps f ))
149- metricsDocFor _ = []
150-
151- documentFor (Namespace out (" Send" : tl)) =
152- documentFor (nsCast (Namespace out tl) :: Namespace (Stateful. AnyMessage ps f ))
153- documentFor (Namespace out (" Receive" : tl)) =
154- documentFor (nsCast (Namespace out tl) :: Namespace (Stateful. AnyMessage ps f ))
155- documentFor _ = Nothing
156-
157- allNamespaces =
158- let cn = allNamespaces :: [Namespace (Stateful. AnyMessage ps f )]
159- in fmap (nsPrependInner " Send" ) cn ++ fmap (nsPrependInner " Receive" ) cn
160-
161-
16228-- --------------------------------------------------------------------------------
16329-- -- TChainSync Tracer
16430-- --------------------------------------------------------------------------------
0 commit comments