/
Network.hs
2020 lines (1824 loc) · 82.1 KB
/
Network.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Tracing.OrphanInstances.Network () where
import Cardano.Prelude hiding (group, show)
import Prelude (String, show, id)
import Control.Monad.Class.MonadTime (DiffTime, Time (..))
import Data.Aeson (Value (..))
import Data.Aeson.Types (listValue)
import qualified Data.Aeson as Aeson
import qualified Data.IP as IP
import qualified Data.Set as Set
import qualified Data.Map.Strict as Map
import Data.Text (pack)
import Network.TypedProtocol.Codec (AnyMessageAndAgency (..))
import Network.TypedProtocol.Core (ClientHasAgency,
PeerHasAgency (..), ServerHasAgency)
import Network.Mux (MuxTrace (..), WithMuxBearer (..), MiniProtocolNum (..))
import Network.Socket (SockAddr (..))
import Cardano.Tracing.ConvertTxId (ConvertTxId)
import Cardano.Tracing.OrphanInstances.Common
import Cardano.Tracing.Render
import Cardano.Node.Configuration.TopologyP2P (UseLedger (..))
import Ouroboros.Consensus.Block (ConvertRawHash (..), Header, getHeader)
import Ouroboros.Consensus.Ledger.Query (BlockQuery, Query)
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx, GenTxId,
HasTxs (..), TxId, txId)
import Ouroboros.Consensus.Node.Run (RunNode, estimateBlockSize)
import qualified Ouroboros.Network.AnchoredFragment as AF
import qualified Ouroboros.Network.AnchoredSeq as AS
import Ouroboros.Network.Block
import Ouroboros.Network.BlockFetch.ClientState (TraceFetchClientState,
TraceLabelPeer (..))
import qualified Ouroboros.Network.BlockFetch.ClientState as BlockFetch
import Ouroboros.Network.BlockFetch.Decision (FetchDecision, FetchDecline (..))
import Ouroboros.Network.ConnectionId (ConnectionId (..))
import Ouroboros.Network.ConnectionManager.Types ( AbstractState(..),
ConnectionManagerTrace(..) , ConnectionManagerCounters(..),
AbstractState(..) , ConnectionManagerCounters(..) , OperationResult(..))
import qualified Ouroboros.Network.ConnectionManager.Types as ConnMgr
import Ouroboros.Network.ConnectionHandler (ConnectionHandlerTrace(..))
import Ouroboros.Network.DeltaQ (GSV (..), PeerGSV (..))
import Ouroboros.Network.Driver.Limits (ProtocolLimitFailure (..))
import Ouroboros.Network.KeepAlive (TraceKeepAliveClient (..))
import Ouroboros.Network.NodeToClient (NodeToClientVersionData(..), NodeToClientVersion)
import qualified Ouroboros.Network.NodeToClient as NtC
import Ouroboros.Network.NodeToNode (ErrorPolicyTrace (..), TraceSendRecv (..),
WithAddr (..), NodeToNodeVersionData (..), NodeToNodeVersion,
RemoteAddress)
import qualified Ouroboros.Network.NodeToNode as NtN
import Ouroboros.Network.PeerSelection.Governor ( PeerSelectionState (..),
PeerSelectionTargets (..), DebugPeerSelection (..),
TracePeerSelection(..), PeerSelectionCounters(..))
import qualified Ouroboros.Network.PeerSelection.KnownPeers as KnownPeers
import Ouroboros.Network.PeerSelection.LedgerPeers
import Ouroboros.Network.PeerSelection.LocalRootPeers (toMap, toGroupSets, LocalRootPeers)
import qualified Ouroboros.Network.PeerSelection.EstablishedPeers as EstablishedPeers
import Ouroboros.Network.PeerSelection.RootPeersDNS ( TraceLocalRootPeers(..),
TracePublicRootPeers(..))
import Ouroboros.Network.PeerSelection.PeerStateActions
( PeerSelectionActionsTrace(..)
)
import Ouroboros.Network.PeerSelection.Types (PeerStatus (..))
import Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch, Message (..))
import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync)
import qualified Ouroboros.Network.Protocol.ChainSync.Type as ChainSync
import Ouroboros.Network.Protocol.Trans.Hello.Type (Hello)
import qualified Ouroboros.Network.Protocol.Trans.Hello.Type as Hello
import Ouroboros.Network.Protocol.LocalStateQuery.Type (LocalStateQuery)
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as LocalStateQuery
import Ouroboros.Network.Protocol.LocalTxSubmission.Type (LocalTxSubmission)
import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Type as LocalTxSub
import Ouroboros.Network.Protocol.TxSubmission.Type (Message (..), TxSubmission)
import Ouroboros.Network.Protocol.TxSubmission2.Type (TxSubmission2)
import Ouroboros.Network.Snocket (LocalAddress (..))
import Ouroboros.Network.Subscription (ConnectResult (..), DnsTrace (..),
SubscriberError (..), SubscriptionTrace (..), WithDomainName (..),
WithIPList (..))
import Ouroboros.Network.TxSubmission.Inbound (ProcessedTxCount (..),
TraceTxSubmissionInbound (..))
import Ouroboros.Network.TxSubmission.Outbound (TraceTxSubmissionOutbound (..))
import Ouroboros.Network.Server2 ( ServerTrace, ServerTrace(..) )
import Ouroboros.Network.Magic (NetworkMagic(..))
import qualified Ouroboros.Network.Server2 as Server
import Ouroboros.Network.InboundGovernor (InboundGovernorTrace(..),
RemoteSt(..))
import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
import Ouroboros.Network.InboundGovernor.State (InboundGovernorCounters(..))
import Ouroboros.Network.Protocol.Handshake (HandshakeException(..),
HandshakeProtocolError (..), RefuseReason (..))
import Ouroboros.Network.RethrowPolicy (ErrorCommand (..))
import qualified Ouroboros.Network.Diffusion as ND
{- HLINT ignore "Use record patterns" -}
--
-- * instances of @HasPrivacyAnnotation@ and @HasSeverityAnnotation@
--
-- NOTE: this list is sorted by the unqualified name of the outermost type.
instance HasPrivacyAnnotation (ND.InitializationTracer ntnAddr ntcAddr)
instance HasSeverityAnnotation (ND.InitializationTracer ntnAddr ntcAddr) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation (NtC.HandshakeTr LocalAddress NodeToClientVersion)
instance HasSeverityAnnotation (NtC.HandshakeTr LocalAddress NodeToClientVersion) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation (NtN.HandshakeTr RemoteAddress NodeToNodeVersion)
instance HasSeverityAnnotation (NtN.HandshakeTr RemoteAddress NodeToNodeVersion) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation NtN.AcceptConnectionsPolicyTrace
instance HasSeverityAnnotation NtN.AcceptConnectionsPolicyTrace where
getSeverityAnnotation NtN.ServerTraceAcceptConnectionRateLimiting {} = Info
getSeverityAnnotation NtN.ServerTraceAcceptConnectionHardLimit {} = Warning
getSeverityAnnotation NtN.ServerTraceAcceptConnectionResume {} = Info
instance HasPrivacyAnnotation (TraceFetchClientState header)
instance HasSeverityAnnotation (TraceFetchClientState header) where
getSeverityAnnotation BlockFetch.AddedFetchRequest {} = Info
getSeverityAnnotation BlockFetch.SendFetchRequest {} = Info
getSeverityAnnotation BlockFetch.AcknowledgedFetchRequest {} = Info
getSeverityAnnotation BlockFetch.StartedFetchBatch {} = Info
getSeverityAnnotation BlockFetch.CompletedBlockFetch {} = Info
getSeverityAnnotation BlockFetch.CompletedFetchBatch {} = Info
getSeverityAnnotation BlockFetch.RejectedFetchBatch {} = Info
getSeverityAnnotation BlockFetch.ClientTerminating {} = Notice
instance HasPrivacyAnnotation (TraceSendRecv a)
instance HasSeverityAnnotation (TraceSendRecv a) where
getSeverityAnnotation _ = Debug
instance HasPrivacyAnnotation a => HasPrivacyAnnotation (TraceLabelPeer peer a)
instance HasSeverityAnnotation a => HasSeverityAnnotation (TraceLabelPeer peer a) where
getSeverityAnnotation (TraceLabelPeer _p a) = getSeverityAnnotation a
instance HasPrivacyAnnotation [TraceLabelPeer peer (FetchDecision [Point header])]
instance HasSeverityAnnotation [TraceLabelPeer peer (FetchDecision [Point header])] where
getSeverityAnnotation [] = Debug
getSeverityAnnotation xs =
maximum $ map (\(TraceLabelPeer _ a) -> fetchDecisionSeverity a) xs
where
fetchDecisionSeverity :: FetchDecision a -> Severity
fetchDecisionSeverity fd =
case fd of
Left FetchDeclineChainNotPlausible -> Debug
Left FetchDeclineChainNoIntersection -> Notice
Left FetchDeclineAlreadyFetched -> Debug
Left FetchDeclineInFlightThisPeer -> Debug
Left FetchDeclineInFlightOtherPeer -> Debug
Left FetchDeclinePeerShutdown -> Info
Left FetchDeclinePeerSlow -> Info
Left FetchDeclineReqsInFlightLimit {} -> Info
Left FetchDeclineBytesInFlightLimit {} -> Info
Left FetchDeclinePeerBusy {} -> Info
Left FetchDeclineConcurrencyLimit {} -> Info
Right _ -> Info
instance HasPrivacyAnnotation (TraceTxSubmissionInbound txid tx)
instance HasSeverityAnnotation (TraceTxSubmissionInbound txid tx) where
getSeverityAnnotation TraceTxSubmissionCollected {} = Debug
getSeverityAnnotation TraceTxSubmissionProcessed {} = Debug
getSeverityAnnotation TraceTxInboundTerminated = Notice
getSeverityAnnotation TraceTxInboundCannotRequestMoreTxs {} = Debug
getSeverityAnnotation TraceTxInboundCanRequestMoreTxs {} = Debug
instance HasPrivacyAnnotation (TraceTxSubmissionOutbound txid tx)
instance HasSeverityAnnotation (TraceTxSubmissionOutbound txid tx) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation (TraceKeepAliveClient remotePeer)
instance HasSeverityAnnotation (TraceKeepAliveClient remotePeer) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation TraceLedgerPeers
instance HasSeverityAnnotation TraceLedgerPeers where
getSeverityAnnotation ev =
case ev of
PickedPeer {} -> Debug
PickedPeers {} -> Info
FetchingNewLedgerState {} -> Info
DisabledLedgerPeers {} -> Info
TraceUseLedgerAfter {} -> Info
WaitingOnRequest {} -> Debug
RequestForPeers {} -> Debug
ReusingLedgerState {} -> Debug
FallingBackToBootstrapPeers {} -> Info
instance HasPrivacyAnnotation (WithAddr addr ErrorPolicyTrace)
instance HasSeverityAnnotation (WithAddr addr ErrorPolicyTrace) where
getSeverityAnnotation (WithAddr _ ev) = case ev of
ErrorPolicySuspendPeer {} -> Warning -- peer misbehaved
ErrorPolicySuspendConsumer {} -> Notice -- peer temporarily not useful
ErrorPolicyLocalNodeError {} -> Error
ErrorPolicyResumePeer {} -> Debug
ErrorPolicyKeepSuspended {} -> Debug
ErrorPolicyResumeConsumer {} -> Debug
ErrorPolicyResumeProducer {} -> Debug
ErrorPolicyUnhandledApplicationException {} -> Error
ErrorPolicyUnhandledConnectionException {} -> Error
ErrorPolicyAcceptException {} -> Error
instance HasPrivacyAnnotation (WithDomainName DnsTrace)
instance HasSeverityAnnotation (WithDomainName DnsTrace) where
getSeverityAnnotation (WithDomainName _ ev) = case ev of
DnsTraceLookupException {} -> Error
DnsTraceLookupAError {} -> Error
DnsTraceLookupAAAAError {} -> Error
DnsTraceLookupIPv6First -> Debug
DnsTraceLookupIPv4First -> Debug
DnsTraceLookupAResult {} -> Debug
DnsTraceLookupAAAAResult {} -> Debug
instance HasPrivacyAnnotation (WithDomainName (SubscriptionTrace SockAddr))
instance HasSeverityAnnotation (WithDomainName (SubscriptionTrace SockAddr)) where
getSeverityAnnotation (WithDomainName _ ev) = case ev of
SubscriptionTraceConnectStart {} -> Notice
SubscriptionTraceConnectEnd {} -> Notice
SubscriptionTraceConnectException _ e ->
case fromException $ SomeException e of
Just (_::SubscriberError) -> Debug
Nothing -> Error
SubscriptionTraceSocketAllocationException {} -> Error
SubscriptionTraceTryConnectToPeer {} -> Info
SubscriptionTraceSkippingPeer {} -> Info
SubscriptionTraceSubscriptionRunning -> Debug
SubscriptionTraceSubscriptionWaiting {} -> Debug
SubscriptionTraceSubscriptionFailed -> Warning
SubscriptionTraceSubscriptionWaitingNewConnection {} -> Debug
SubscriptionTraceStart {} -> Debug
SubscriptionTraceRestart {} -> Debug
SubscriptionTraceConnectionExist {} -> Info
SubscriptionTraceUnsupportedRemoteAddr {} -> Warning
SubscriptionTraceMissingLocalAddress -> Warning
SubscriptionTraceApplicationException _ e ->
case fromException $ SomeException e of
Just (_::SubscriberError) -> Debug
Nothing -> Error
SubscriptionTraceAllocateSocket {} -> Debug
SubscriptionTraceCloseSocket {} -> Debug
instance HasPrivacyAnnotation (WithIPList (SubscriptionTrace SockAddr))
instance HasSeverityAnnotation (WithIPList (SubscriptionTrace SockAddr)) where
getSeverityAnnotation (WithIPList _ _ ev) = case ev of
SubscriptionTraceConnectStart _ -> Info
SubscriptionTraceConnectEnd _ connectResult -> case connectResult of
ConnectSuccess -> Info
ConnectSuccessLast -> Notice
ConnectValencyExceeded -> Warning
SubscriptionTraceConnectException _ e ->
case fromException $ SomeException e of
Just (_::SubscriberError) -> Debug
Nothing -> Error
SubscriptionTraceSocketAllocationException {} -> Error
SubscriptionTraceTryConnectToPeer {} -> Info
SubscriptionTraceSkippingPeer {} -> Info
SubscriptionTraceSubscriptionRunning -> Debug
SubscriptionTraceSubscriptionWaiting {} -> Debug
SubscriptionTraceSubscriptionFailed -> Error
SubscriptionTraceSubscriptionWaitingNewConnection {} -> Notice
SubscriptionTraceStart {} -> Debug
SubscriptionTraceRestart {} -> Info
SubscriptionTraceConnectionExist {} -> Notice
SubscriptionTraceUnsupportedRemoteAddr {} -> Error
SubscriptionTraceMissingLocalAddress -> Warning
SubscriptionTraceApplicationException _ e ->
case fromException $ SomeException e of
Just (_::SubscriberError) -> Debug
Nothing -> Error
SubscriptionTraceAllocateSocket {} -> Debug
SubscriptionTraceCloseSocket {} -> Info
instance HasPrivacyAnnotation (Identity (SubscriptionTrace LocalAddress))
instance HasSeverityAnnotation (Identity (SubscriptionTrace LocalAddress)) where
getSeverityAnnotation (Identity ev) = case ev of
SubscriptionTraceConnectStart {} -> Notice
SubscriptionTraceConnectEnd {} -> Notice
SubscriptionTraceConnectException {} -> Error
SubscriptionTraceSocketAllocationException {} -> Error
SubscriptionTraceTryConnectToPeer {} -> Notice
SubscriptionTraceSkippingPeer {} -> Info
SubscriptionTraceSubscriptionRunning -> Notice
SubscriptionTraceSubscriptionWaiting {} -> Debug
SubscriptionTraceSubscriptionFailed -> Warning
SubscriptionTraceSubscriptionWaitingNewConnection {} -> Debug
SubscriptionTraceStart {} -> Notice
SubscriptionTraceRestart {} -> Notice
SubscriptionTraceConnectionExist {} -> Debug
SubscriptionTraceUnsupportedRemoteAddr {} -> Warning
SubscriptionTraceMissingLocalAddress -> Warning
SubscriptionTraceApplicationException {} -> Error
SubscriptionTraceAllocateSocket {} -> Debug
SubscriptionTraceCloseSocket {} -> Debug
instance Transformable Text IO (Identity (SubscriptionTrace LocalAddress)) where
trTransformer = trStructuredText
instance HasTextFormatter (Identity (SubscriptionTrace LocalAddress)) where
formatText a _ = pack (show a)
instance ToObject (Identity (SubscriptionTrace LocalAddress)) where
toObject _verb (Identity ev) =
mkObject [ "kind" .= ("SubscriptionTrace" :: String)
, "event" .= show ev
]
instance HasPrivacyAnnotation (WithMuxBearer peer MuxTrace)
instance HasSeverityAnnotation (WithMuxBearer peer MuxTrace) where
getSeverityAnnotation (WithMuxBearer _ ev) = case ev of
MuxTraceRecvHeaderStart -> Debug
MuxTraceRecvHeaderEnd {} -> Debug
MuxTraceRecvStart {} -> Debug
MuxTraceRecvEnd {} -> Debug
MuxTraceSendStart {} -> Debug
MuxTraceSendEnd -> Debug
MuxTraceState {} -> Info
MuxTraceCleanExit {} -> Notice
MuxTraceExceptionExit {} -> Notice
MuxTraceChannelRecvStart {} -> Debug
MuxTraceChannelRecvEnd {} -> Debug
MuxTraceChannelSendStart {} -> Debug
MuxTraceChannelSendEnd {} -> Debug
MuxTraceHandshakeStart -> Debug
MuxTraceHandshakeClientEnd {} -> Info
MuxTraceHandshakeServerEnd -> Debug
MuxTraceHandshakeClientError {} -> Error
MuxTraceHandshakeServerError {} -> Error
MuxTraceRecvDeltaQObservation {} -> Debug
MuxTraceRecvDeltaQSample {} -> Debug
MuxTraceSDUReadTimeoutException -> Notice
MuxTraceSDUWriteTimeoutException -> Notice
MuxTraceStartEagerly _ _ -> Info
MuxTraceStartOnDemand _ _ -> Info
MuxTraceStartedOnDemand _ _ -> Info
MuxTraceShutdown -> Debug
MuxTraceTerminating {} -> Debug
instance HasPrivacyAnnotation (TraceLocalRootPeers RemoteAddress exception)
instance HasSeverityAnnotation (TraceLocalRootPeers RemoteAddress exception) where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation TracePublicRootPeers
instance HasSeverityAnnotation TracePublicRootPeers where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation (TracePeerSelection addr)
instance HasSeverityAnnotation (TracePeerSelection addr) where
getSeverityAnnotation ev =
case ev of
TraceLocalRootPeersChanged {} -> Notice
TraceTargetsChanged {} -> Notice
TracePublicRootsRequest {} -> Info
TracePublicRootsResults {} -> Info
TracePublicRootsFailure {} -> Error
TraceGossipRequests {} -> Debug
TraceGossipResults {} -> Debug
TraceForgetColdPeers {} -> Info
TracePromoteColdPeers {} -> Info
TracePromoteColdLocalPeers {} -> Info
TracePromoteColdFailed {} -> Info
TracePromoteColdDone {} -> Info
TracePromoteWarmPeers {} -> Info
TracePromoteWarmLocalPeers {} -> Info
TracePromoteWarmFailed {} -> Info
TracePromoteWarmDone {} -> Info
TraceDemoteWarmPeers {} -> Info
TraceDemoteWarmFailed {} -> Info
TraceDemoteWarmDone {} -> Info
TraceDemoteHotPeers {} -> Info
TraceDemoteLocalHotPeers {} -> Info
TraceDemoteHotFailed {} -> Info
TraceDemoteHotDone {} -> Info
TraceDemoteAsynchronous {} -> Info
TraceGovernorWakeup {} -> Info
TraceChurnWait {} -> Info
TraceChurnMode {} -> Info
instance HasPrivacyAnnotation (DebugPeerSelection addr conn)
instance HasSeverityAnnotation (DebugPeerSelection addr conn) where
getSeverityAnnotation _ = Debug
instance HasPrivacyAnnotation (PeerSelectionActionsTrace SockAddr)
instance HasSeverityAnnotation (PeerSelectionActionsTrace SockAddr) where
getSeverityAnnotation ev =
case ev of
PeerStatusChanged {} -> Info
PeerStatusChangeFailure {} -> Error
PeerMonitoringError {} -> Error
PeerMonitoringResult {} -> Debug
instance HasPrivacyAnnotation PeerSelectionCounters
instance HasSeverityAnnotation PeerSelectionCounters where
getSeverityAnnotation _ = Info
instance HasPrivacyAnnotation (ConnectionManagerTrace addr connTrace)
instance HasSeverityAnnotation (ConnectionManagerTrace addr (ConnectionHandlerTrace versionNumber agreedOptions)) where
getSeverityAnnotation ev =
case ev of
TrIncludeConnection {} -> Debug
TrUnregisterConnection {} -> Debug
TrConnect {} -> Debug
TrConnectError {} -> Info
TrTerminatingConnection {} -> Debug
TrTerminatedConnection {} -> Debug
TrConnectionHandler _ ev' ->
case ev' of
TrHandshakeSuccess {} -> Info
TrHandshakeClientError {} -> Notice
TrHandshakeServerError {} -> Info
TrError _ _ ShutdownNode -> Critical
TrError _ _ ShutdownPeer -> Info
TrShutdown -> Info
TrConnectionExists {} -> Info
TrForbiddenConnection {} -> Info
TrImpossibleConnection {} -> Info
TrConnectionFailure {} -> Info
TrConnectionNotFound {} -> Debug
TrForbiddenOperation {} -> Info
TrPruneConnections {} -> Notice
TrConnectionCleanup {} -> Debug
TrConnectionTimeWait {} -> Debug
TrConnectionTimeWaitDone {} -> Debug
TrConnectionManagerCounters {} -> Info
TrState {} -> Info
ConnMgr.TrUnexpectedlyFalseAssertion {} -> Error
instance HasPrivacyAnnotation (ServerTrace addr)
instance HasSeverityAnnotation (ServerTrace addr) where
getSeverityAnnotation ev =
case ev of
Server.TrAcceptConnection {} -> Debug
Server.TrAcceptError {} -> Error
Server.TrAcceptPolicyTrace {} -> Notice
Server.TrServerStarted {} -> Notice
Server.TrServerStopped {} -> Notice
Server.TrServerError {} -> Critical
instance HasPrivacyAnnotation (InboundGovernorTrace addr)
instance HasSeverityAnnotation (InboundGovernorTrace addr) where
getSeverityAnnotation ev =
case ev of
InboundGovernor.TrNewConnection {} -> Debug
InboundGovernor.TrResponderRestarted {} -> Debug
InboundGovernor.TrResponderStartFailure {} -> Error
InboundGovernor.TrResponderErrored {} -> Info
InboundGovernor.TrResponderStarted {} -> Debug
InboundGovernor.TrResponderTerminated {} -> Debug
InboundGovernor.TrPromotedToWarmRemote {} -> Info
InboundGovernor.TrPromotedToHotRemote {} -> Info
InboundGovernor.TrDemotedToColdRemote {} -> Info
InboundGovernor.TrWaitIdleRemote {} -> Debug
InboundGovernor.TrMuxCleanExit {} -> Debug
InboundGovernor.TrMuxErrored {} -> Info
InboundGovernor.TrInboundGovernorCounters {} -> Info
InboundGovernor.TrRemoteState {} -> Debug
InboundGovernor.TrUnexpectedlyFalseAssertion {}
-> Error
--
-- | instances of @Transformable@
--
-- NOTE: this list is sorted by the unqualified name of the outermost type.
instance Transformable Text IO (ND.InitializationTracer RemoteAddress LocalAddress) where
trTransformer = trStructuredText
instance HasTextFormatter (ND.InitializationTracer RemoteAddress LocalAddress) where
formatText a _ = pack (show a)
instance Transformable Text IO (NtN.HandshakeTr RemoteAddress NodeToNodeVersion) where
trTransformer = trStructuredText
instance HasTextFormatter (NtN.HandshakeTr RemoteAddress NodeToNodeVersion) where
formatText a _ = pack (show a)
instance Transformable Text IO (NtC.HandshakeTr LocalAddress NodeToClientVersion) where
trTransformer = trStructuredText
instance HasTextFormatter (NtC.HandshakeTr LocalAddress NodeToClientVersion) where
formatText a _ = pack (show a)
instance Transformable Text IO NtN.AcceptConnectionsPolicyTrace where
trTransformer = trStructuredText
instance HasTextFormatter NtN.AcceptConnectionsPolicyTrace where
formatText a _ = pack (show a)
instance (StandardHash header, Show peer, ToObject peer)
=> Transformable Text IO [TraceLabelPeer peer (FetchDecision [Point header])] where
trTransformer = trStructuredText
instance (StandardHash header, Show peer)
=> HasTextFormatter [TraceLabelPeer peer (FetchDecision [Point header])] where
formatText a _ = pack (show a)
instance (HasHeader header, ConvertRawHash header, ToObject peer)
=> Transformable Text IO (TraceLabelPeer peer (TraceFetchClientState header)) where
trTransformer = trStructured
instance (Show header, StandardHash header, Show peer)
=> HasTextFormatter (TraceLabelPeer peer (TraceFetchClientState header)) where
formatText a _ = pack (show a)
instance ToObject peer
=> Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk)))) where
trTransformer = trStructured
instance (Show peer, StandardHash blk, Show (Header blk))
=> HasTextFormatter (TraceLabelPeer peer (NtN.TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk)))) where
formatText a _ = pack (show a)
instance (ToObject peer, ToObject (AnyMessageAndAgency (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk))))
=> Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk)))) where
trTransformer = trStructured
instance ToObject peer
=> Transformable Text IO (TraceLabelPeer peer (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk))) where
trTransformer = trStructured
instance (ToObject peer, ConvertTxId blk, RunNode blk, HasTxs blk)
=> Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (BlockFetch blk (Point blk)))) where
trTransformer = trStructured
instance ToObject localPeer
=> Transformable Text IO (TraceLabelPeer localPeer (NtN.TraceSendRecv (ChainSync (Serialised blk) (Point blk) (Tip blk)))) where
trTransformer = trStructured
instance (applyTxErr ~ ApplyTxErr blk, ToObject localPeer)
=> Transformable Text IO (TraceLabelPeer localPeer (NtN.TraceSendRecv (LocalTxSubmission (GenTx blk) applyTxErr))) where
trTransformer = trStructured
instance (LocalStateQuery.ShowQuery (BlockQuery blk), ToObject localPeer)
=> Transformable Text IO (TraceLabelPeer localPeer (NtN.TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk)))) where
trTransformer = trStructured
instance (ToObject peer, Show (TxId (GenTx blk)), Show (GenTx blk))
=> Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)))) where
trTransformer = trStructured
instance (ToObject peer, Show (TxId (GenTx blk)), Show (GenTx blk))
=> Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (TxSubmission (GenTxId blk) (GenTx blk)))) where
trTransformer = trStructured
instance (ToObject peer, Show (TxId (GenTx blk)), Show (GenTx blk))
=> Transformable Text IO (TraceLabelPeer peer (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk))) where
trTransformer = trStructured
instance Transformable Text IO (TraceTxSubmissionInbound txid tx) where
trTransformer = trStructuredText
instance HasTextFormatter (TraceTxSubmissionInbound txid tx) where
formatText a _ = pack (show a)
instance (Show tx, Show txid)
=> Transformable Text IO (TraceTxSubmissionOutbound txid tx) where
trTransformer = trStructuredText
instance (Show tx, Show txid)
=> HasTextFormatter (TraceTxSubmissionOutbound txid tx) where
formatText a _ = pack (show a)
instance Show addr
=> Transformable Text IO (TraceKeepAliveClient addr) where
trTransformer = trStructuredText
instance Show addr
=> HasTextFormatter (TraceKeepAliveClient addr) where
formatText a _ = pack (show a)
instance Transformable Text IO TraceLedgerPeers where
trTransformer = trStructuredText
instance HasTextFormatter TraceLedgerPeers where
formatText _ = pack . show . toList
instance Show addr => Transformable Text IO (WithAddr addr ErrorPolicyTrace) where
trTransformer = trStructuredText
instance Show addr => HasTextFormatter (WithAddr addr ErrorPolicyTrace) where
formatText a _ = pack (show a)
instance Transformable Text IO (WithDomainName (SubscriptionTrace SockAddr)) where
trTransformer = trStructuredText
instance HasTextFormatter (WithDomainName (SubscriptionTrace SockAddr)) where
formatText a _ = pack (show a)
instance Transformable Text IO (WithDomainName DnsTrace) where
trTransformer = trStructuredText
instance HasTextFormatter (WithDomainName DnsTrace) where
formatText a _ = pack (show a)
instance Transformable Text IO (WithIPList (SubscriptionTrace SockAddr)) where
trTransformer = trStructuredText
instance HasTextFormatter (WithIPList (SubscriptionTrace SockAddr)) where
formatText a _ = pack (show a)
instance (Show peer, ToObject peer)
=> Transformable Text IO (WithMuxBearer peer MuxTrace) where
trTransformer = trStructuredText
instance (Show peer)
=> HasTextFormatter (WithMuxBearer peer MuxTrace) where
formatText (WithMuxBearer peer ev) = \_o ->
"Bearer on " <> pack (show peer)
<> " event: " <> pack (show ev)
instance Show exception => Transformable Text IO (TraceLocalRootPeers RemoteAddress exception) where
trTransformer = trStructuredText
instance Show exception => HasTextFormatter (TraceLocalRootPeers RemoteAddress exception) where
formatText a _ = pack (show a)
instance Transformable Text IO TracePublicRootPeers where
trTransformer = trStructuredText
instance HasTextFormatter TracePublicRootPeers where
formatText a _ = pack (show a)
instance Transformable Text IO (TracePeerSelection SockAddr) where
trTransformer = trStructuredText
instance HasTextFormatter (TracePeerSelection SockAddr) where
formatText a _ = pack (show a)
instance Show conn
=> Transformable Text IO (DebugPeerSelection SockAddr conn) where
trTransformer = trStructuredText
instance HasTextFormatter (DebugPeerSelection SockAddr conn) where
-- One can only change what is logged with respect to verbosity using json
-- format.
formatText _ obj = pack (show obj)
instance Transformable Text IO (PeerSelectionActionsTrace SockAddr) where
trTransformer = trStructuredText
instance HasTextFormatter (PeerSelectionActionsTrace SockAddr) where
formatText a _ = pack (show a)
instance Transformable Text IO PeerSelectionCounters where
trTransformer = trStructuredText
instance HasTextFormatter PeerSelectionCounters where
formatText a _ = pack (show a)
instance (Show addr, Show versionNumber, Show agreedOptions, ToObject addr,
ToJSON addr, ToJSON versionNumber, ToJSON agreedOptions
)
=> Transformable Text IO (ConnectionManagerTrace
addr
(ConnectionHandlerTrace versionNumber agreedOptions)) where
trTransformer = trStructuredText
instance (Show addr, Show versionNumber, Show agreedOptions)
=> HasTextFormatter (ConnectionManagerTrace
addr
(ConnectionHandlerTrace versionNumber agreedOptions)) where
formatText a _ = pack (show a)
instance (Show addr, ToObject addr, ToJSON addr)
=> Transformable Text IO (ServerTrace addr) where
trTransformer = trStructuredText
instance Show addr
=> HasTextFormatter (ServerTrace addr) where
formatText a _ = pack (show a)
instance (ToJSON addr, Show addr)
=> Transformable Text IO (InboundGovernorTrace addr) where
trTransformer = trStructuredText
instance Show addr
=> HasTextFormatter (InboundGovernorTrace addr) where
formatText a _ = pack (show a)
--
-- | instances of @ToObject@
--
-- NOTE: this list is sorted by the unqualified name of the outermost type.
instance ( ConvertTxId blk
, RunNode blk
, HasTxs blk
)
=> ToObject (AnyMessageAndAgency (BlockFetch blk (Point blk))) where
toObject MinimalVerbosity (AnyMessageAndAgency stok (MsgBlock blk)) =
mkObject [ "kind" .= String "MsgBlock"
, "agency" .= String (pack $ show stok)
, "blockHash" .= renderHeaderHash (Proxy @blk) (blockHash blk)
, "blockSize" .= toJSON (estimateBlockSize (getHeader blk))
]
toObject verb (AnyMessageAndAgency stok (MsgBlock blk)) =
mkObject [ "kind" .= String "MsgBlock"
, "agency" .= String (pack $ show stok)
, "blockHash" .= renderHeaderHash (Proxy @blk) (blockHash blk)
, "blockSize" .= toJSON (estimateBlockSize (getHeader blk))
, "txIds" .= toJSON (presentTx <$> extractTxs blk)
]
where
presentTx :: GenTx blk -> Value
presentTx = String . renderTxIdForVerbosity verb . txId
toObject _v (AnyMessageAndAgency stok MsgRequestRange{}) =
mkObject [ "kind" .= String "MsgRequestRange"
, "agency" .= String (pack $ show stok)
]
toObject _v (AnyMessageAndAgency stok MsgStartBatch{}) =
mkObject [ "kind" .= String "MsgStartBatch"
, "agency" .= String (pack $ show stok)
]
toObject _v (AnyMessageAndAgency stok MsgNoBlocks{}) =
mkObject [ "kind" .= String "MsgNoBlocks"
, "agency" .= String (pack $ show stok)
]
toObject _v (AnyMessageAndAgency stok MsgBatchDone{}) =
mkObject [ "kind" .= String "MsgBatchDone"
, "agency" .= String (pack $ show stok)
]
toObject _v (AnyMessageAndAgency stok MsgClientDone{}) =
mkObject [ "kind" .= String "MsgClientDone"
, "agency" .= String (pack $ show stok)
]
instance ( ToObject (AnyMessageAndAgency ps)
, forall (st :: ps). Show (ClientHasAgency st)
, forall (st :: ps). Show (ServerHasAgency st)
)
=> ToObject (AnyMessageAndAgency (Hello ps stIdle)) where
toObject verb (AnyMessageAndAgency stok msg) =
case (stok, msg) of
(_, Hello.MsgHello) ->
mkObject [ "kind" .= String "MsgHello"
, "agency" .= String (pack $ show stok)
]
( ClientAgency (Hello.TokClientTalk tok)
, Hello.MsgTalk msg' ) ->
mkObject [ "kind" .= String "MsgTalk"
, "message" .=
toObject verb
(AnyMessageAndAgency (ClientAgency tok) msg')
]
( ServerAgency (Hello.TokServerTalk tok)
, Hello.MsgTalk msg' ) ->
mkObject [ "kind" .= String "MsgTalk"
, "message" .=
toObject verb
(AnyMessageAndAgency (ServerAgency tok) msg')
]
instance (forall result. Show (query result))
=> ToObject (AnyMessageAndAgency (LocalStateQuery blk pt query)) where
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgAcquire{}) =
mkObject [ "kind" .= String "MsgAcquire"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgAcquired{}) =
mkObject [ "kind" .= String "MsgAcquired"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgFailure{}) =
mkObject [ "kind" .= String "MsgFailure"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgQuery{}) =
mkObject [ "kind" .= String "MsgQuery"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgResult{}) =
mkObject [ "kind" .= String "MsgResult"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgRelease{}) =
mkObject [ "kind" .= String "MsgRelease"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgReAcquire{}) =
mkObject [ "kind" .= String "MsgReAcquire"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalStateQuery.MsgDone{}) =
mkObject [ "kind" .= String "MsgDone"
, "agency" .= String (pack $ show stok)
]
instance ToObject (AnyMessageAndAgency (LocalTxSubmission tx err)) where
toObject _verb (AnyMessageAndAgency stok LocalTxSub.MsgSubmitTx{}) =
mkObject [ "kind" .= String "MsgSubmitTx"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalTxSub.MsgAcceptTx{}) =
mkObject [ "kind" .= String "MsgAcceptTx"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalTxSub.MsgRejectTx{}) =
mkObject [ "kind" .= String "MsgRejectTx"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok LocalTxSub.MsgDone{}) =
mkObject [ "kind" .= String "MsgDone"
, "agency" .= String (pack $ show stok)
]
instance ToObject (AnyMessageAndAgency (ChainSync blk pt tip)) where
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgRequestNext{}) =
mkObject [ "kind" .= String "MsgRequestNext"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgAwaitReply{}) =
mkObject [ "kind" .= String "MsgAwaitReply"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgRollForward{}) =
mkObject [ "kind" .= String "MsgRollForward"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgRollBackward{}) =
mkObject [ "kind" .= String "MsgRollBackward"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgFindIntersect{}) =
mkObject [ "kind" .= String "MsgFindIntersect"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgIntersectFound{}) =
mkObject [ "kind" .= String "MsgIntersectFound"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgIntersectNotFound{}) =
mkObject [ "kind" .= String "MsgIntersectNotFound"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok ChainSync.MsgDone{}) =
mkObject [ "kind" .= String "MsgDone"
, "agency" .= String (pack $ show stok)
]
instance (Show txid, Show tx)
=> ToObject (AnyMessageAndAgency (TxSubmission txid tx)) where
toObject _verb (AnyMessageAndAgency stok (MsgRequestTxs txids)) =
mkObject
[ "kind" .= String "MsgRequestTxs"
, "agency" .= String (pack $ show stok)
, "txIds" .= String (pack $ show txids)
]
toObject _verb (AnyMessageAndAgency stok (MsgReplyTxs txs)) =
mkObject
[ "kind" .= String "MsgReplyTxs"
, "agency" .= String (pack $ show stok)
, "txs" .= String (pack $ show txs)
]
toObject _verb (AnyMessageAndAgency stok MsgRequestTxIds{}) =
mkObject
[ "kind" .= String "MsgRequestTxIds"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok (MsgReplyTxIds _)) =
mkObject
[ "kind" .= String "MsgReplyTxIds"
, "agency" .= String (pack $ show stok)
]
toObject _verb (AnyMessageAndAgency stok MsgDone) =
mkObject
[ "kind" .= String "MsgDone"
, "agency" .= String (pack $ show stok)
]
instance ToJSON peerAddr => ToJSON (ConnectionId peerAddr) where
toJSON ConnectionId { localAddress, remoteAddress } =
Aeson.object [ "localAddress" .= toJSON localAddress
, "remoteAddress" .= toJSON remoteAddress
]
instance Aeson.ToJSON ConnectionManagerCounters where
toJSON ConnectionManagerCounters { prunableConns
, duplexConns
, uniConns
, incomingConns
, outgoingConns
} =
Aeson.object [ "kind" .= String "ConnectionManagerCounters"
, "prunable" .= toJSON prunableConns
, "duplex" .= toJSON duplexConns
, "unidirectional" .= toJSON uniConns
, "incoming" .= incomingConns
, "outgoing" .= outgoingConns
]
instance ToObject (FetchDecision [Point header]) where
toObject _verb (Left decline) =
mkObject [ "kind" .= String "FetchDecision declined"
, "declined" .= String (pack (show decline))
]
toObject _verb (Right results) =
mkObject [ "kind" .= String "FetchDecision results"
, "length" .= String (pack $ show $ length results)
]
-- TODO: use 'ToJSON' constraints
instance (Show ntnAddr, Show ntcAddr) => ToObject (ND.InitializationTracer ntnAddr ntcAddr) where
toObject _verb (ND.RunServer sockAddr) = mkObject
[ "kind" .= String "RunServer"
, "socketAddress" .= String (pack (show sockAddr))
]
toObject _verb (ND.RunLocalServer localAddress) = mkObject
[ "kind" .= String "RunLocalServer"
, "localAddress" .= String (pack (show localAddress))
]
toObject _verb (ND.UsingSystemdSocket localAddress) = mkObject
[ "kind" .= String "UsingSystemdSocket"
, "path" .= String (pack . show $ localAddress)
]
toObject _verb (ND.CreateSystemdSocketForSnocketPath localAddress) = mkObject
[ "kind" .= String "CreateSystemdSocketForSnocketPath"
, "path" .= String (pack . show $ localAddress)
]
toObject _verb (ND.CreatedLocalSocket localAddress) = mkObject
[ "kind" .= String "CreatedLocalSocket"
, "path" .= String (pack . show $ localAddress)
]
toObject _verb (ND.ConfiguringLocalSocket localAddress socket) = mkObject
[ "kind" .= String "ConfiguringLocalSocket"
, "path" .= String (pack . show $ localAddress)
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.ListeningLocalSocket localAddress socket) = mkObject
[ "kind" .= String "ListeningLocalSocket"
, "path" .= String (pack . show $ localAddress)
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.LocalSocketUp localAddress fd) = mkObject
[ "kind" .= String "LocalSocketUp"
, "path" .= String (pack . show $ localAddress)
, "socket" .= String (pack (show fd))
]
toObject _verb (ND.CreatingServerSocket socket) = mkObject
[ "kind" .= String "CreatingServerSocket"
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.ListeningServerSocket socket) = mkObject
[ "kind" .= String "ListeningServerSocket"
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.ServerSocketUp socket) = mkObject
[ "kind" .= String "ServerSocketUp"
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.ConfiguringServerSocket socket) = mkObject
[ "kind" .= String "ConfiguringServerSocket"
, "socket" .= String (pack (show socket))
]
toObject _verb (ND.UnsupportedLocalSystemdSocket path) = mkObject
[ "kind" .= String "UnsupportedLocalSystemdSocket"
, "path" .= String (pack (show path))
]
toObject _verb ND.UnsupportedReadySocketCase = mkObject
[ "kind" .= String "UnsupportedReadySocketCase"
]
toObject _verb (ND.DiffusionErrored exception) = mkObject
[ "kind" .= String "DiffusionErrored"
, "path" .= String (pack (show exception))
]
instance ToObject (NtC.HandshakeTr LocalAddress NodeToClientVersion) where
toObject _verb (WithMuxBearer b ev) =
mkObject [ "kind" .= String "LocalHandshakeTrace"
, "bearer" .= show b
, "event" .= show ev ]