@@ -68,8 +68,8 @@ import Ouroboros.Network.ConnectionId (ConnectionId (..))
68
68
import Ouroboros.Network.SizeInBytes (SizeInBytes (.. ))
69
69
import Ouroboros.Network.TxSubmission.Inbound hiding (txId )
70
70
import Ouroboros.Network.TxSubmission.Outbound
71
+ import qualified Cardano.KESAgent.Processes.ServiceClient as Agent
71
72
72
- import Control.Exception
73
73
import Control.Monad (guard )
74
74
import Data.Aeson (ToJSON , Value (.. ), toJSON , (.=) )
75
75
import qualified Data.Aeson as Aeson
@@ -2305,12 +2305,135 @@ instance ( StandardHash blk
2305
2305
KES-agent
2306
2306
-------------------------------------------------------------------------------}
2307
2307
2308
+ --------------------------------------------------------------------------------
2309
+ -- KES Agent tracer
2310
+ --------------------------------------------------------------------------------
2311
+
2312
+ instance LogFormatting Agent. ServiceClientTrace where
2313
+ forMachine _dtal = \ case
2314
+ Agent. ServiceClientVersionHandshakeTrace _vhdt ->
2315
+ mconcat [ " kind" .= String " ServiceClientVersionHandshakeTrace" ]
2316
+ Agent. ServiceClientVersionHandshakeFailed ->
2317
+ mconcat [ " kind" .= String " ServiceClientVersionHandshakeFailed" ]
2318
+ Agent. ServiceClientDriverTrace _sdt ->
2319
+ mconcat [ " kind" .= String " ServiceClientDriverTrace" ]
2320
+ Agent. ServiceClientSocketClosed ->
2321
+ mconcat [ " kind" .= String " ServiceClientSocketClosed" ]
2322
+ Agent. ServiceClientConnected _s ->
2323
+ mconcat [ " kind" .= String " ServiceClientConnected" ]
2324
+ Agent. ServiceClientAttemptReconnect {} ->
2325
+ mconcat [ " kind" .= String " ServiceClientAttemptReconnect" ]
2326
+ Agent. ServiceClientReceivedKey _tbt ->
2327
+ mconcat [ " kind" .= String " ServiceClientReceivedKey" ]
2328
+ Agent. ServiceClientDeclinedKey _tbt ->
2329
+ mconcat [ " kind" .= String " ServiceClientDeclinedKey" ]
2330
+ Agent. ServiceClientDroppedKey ->
2331
+ mconcat [ " kind" .= String " ServiceClientDroppedKey" ]
2332
+ Agent. ServiceClientOpCertNumberCheck _ _ ->
2333
+ mconcat [ " kind" .= String " ServiceClientOpCertNumberCheck" ]
2334
+ Agent. ServiceClientAbnormalTermination _s ->
2335
+ mconcat [ " kind" .= String " ServiceClientAbnormalTermination" ]
2336
+ Agent. ServiceClientStopped ->
2337
+ mconcat [ " kind" .= String " ServiceClientStopped" ]
2338
+
2339
+ forHuman = showT
2340
+
2341
+ instance MetaTrace Agent. ServiceClientTrace where
2342
+ namespaceFor = \ case
2343
+ Agent. ServiceClientVersionHandshakeTrace _vhdt ->
2344
+ Namespace [] [" ServiceClientVersionHandshakeTrace" ]
2345
+ Agent. ServiceClientVersionHandshakeFailed ->
2346
+ Namespace [] [" ServiceClientVersionHandshakeFailed" ]
2347
+ Agent. ServiceClientDriverTrace _sdt ->
2348
+ Namespace [] [" ServiceClientDriverTrace" ]
2349
+ Agent. ServiceClientSocketClosed ->
2350
+ Namespace [] [" ServiceClientSocketClosed" ]
2351
+ Agent. ServiceClientConnected _s ->
2352
+ Namespace [] [" ServiceClientConnected" ]
2353
+ Agent. ServiceClientAttemptReconnect {} ->
2354
+ Namespace [] [" ServiceClientAttemptReconnect" ]
2355
+ Agent. ServiceClientReceivedKey _tbt ->
2356
+ Namespace [] [" ServiceClientReceivedKey" ]
2357
+ Agent. ServiceClientDeclinedKey _tbt ->
2358
+ Namespace [] [" ServiceClientDeclinedKey" ]
2359
+ Agent. ServiceClientDroppedKey ->
2360
+ Namespace [] [" ServiceClientDroppedKey" ]
2361
+ Agent. ServiceClientOpCertNumberCheck _ _ ->
2362
+ Namespace [] [" ServiceClientOpCertNumberCheck" ]
2363
+ Agent. ServiceClientAbnormalTermination _s ->
2364
+ Namespace [] [" ServiceClientAbnormalTermination" ]
2365
+ Agent. ServiceClientStopped ->
2366
+ Namespace [] [" ServiceClientStopped" ]
2367
+
2368
+ severityFor ns _ = case ns of
2369
+ Namespace [] [" ServiceClientVersionHandshakeTrace" ] ->
2370
+ Just Debug
2371
+ Namespace [] [" ServiceClientVersionHandshakeFailed" ] ->
2372
+ Just Error
2373
+ Namespace [] [" ServiceClientDriverTrace" ] ->
2374
+ Just Debug
2375
+ Namespace [] [" ServiceClientSocketClosed" ] ->
2376
+ Just Info
2377
+ Namespace [] [" ServiceClientConnected" ] ->
2378
+ Just Info
2379
+ Namespace [] [" ServiceClientAttemptReconnect" ] ->
2380
+ Just Info
2381
+ Namespace [] [" ServiceClientReceivedKey" ] ->
2382
+ Just Info
2383
+ Namespace [] [" ServiceClientDeclinedKey" ] ->
2384
+ Just Info
2385
+ Namespace [] [" ServiceClientDroppedKey" ] ->
2386
+ Just Info
2387
+ Namespace [] [" ServiceClientOpCertNumberCheck" ] ->
2388
+ Just Debug
2389
+ Namespace [] [" ServiceClientAbnormalTermination" ] ->
2390
+ Just Error
2391
+ Namespace [] [" ServiceClientStopped" ] ->
2392
+ Just Info
2393
+ Namespace _ _ -> Nothing
2394
+
2395
+ documentFor _ = Nothing
2396
+ allNamespaces =
2397
+ [ Namespace [] [" ServiceClientVersionHandshakeTrace" ]
2398
+ , Namespace [] [" ServiceClientVersionHandshakeFailed" ]
2399
+ , Namespace [] [" ServiceClientDriverTrace" ]
2400
+ , Namespace [] [" ServiceClientSocketClosed" ]
2401
+ , Namespace [] [" ServiceClientConnected" ]
2402
+ , Namespace [] [" ServiceClientAttemptReconnect" ]
2403
+ , Namespace [] [" ServiceClientReceivedKey" ]
2404
+ , Namespace [] [" ServiceClientDeclinedKey" ]
2405
+ , Namespace [] [" ServiceClientDroppedKey" ]
2406
+ , Namespace [] [" ServiceClientOpCertNumberCheck" ]
2407
+ , Namespace [] [" ServiceClientAbnormalTermination" ]
2408
+ , Namespace [] [" ServiceClientStopped" ]
2409
+ ]
2410
+
2308
2411
instance LogFormatting KESAgentClientTrace where
2309
- forMachine _verb (KESAgentClientException exc) =
2310
- mconcat [ " kind" .= String " KESAgentClientException"
2311
- , " exception" .= String (Text. pack $ displayException exc)
2312
- ]
2313
- forMachine _verb (KESAgentClientTrace trc) =
2314
- mconcat [ " kind" .= String " KESAgentClientTrace"
2315
- , " trace" .= String (Text. pack $ show trc)
2316
- ]
2412
+ forMachine dtal = \ case
2413
+ KESAgentClientException ex -> mconcat
2414
+ [ " kind" .= String " KESAgentClientException"
2415
+ , " exception" .= String (Text. pack $ show ex)
2416
+ ]
2417
+ KESAgentClientTrace t -> mconcat
2418
+ [ " kind" .= String " KESAgentClientTrace"
2419
+ , " trace" .= forMachine dtal t
2420
+ ]
2421
+
2422
+ forHuman = showT
2423
+
2424
+
2425
+ instance MetaTrace KESAgentClientTrace where
2426
+ namespaceFor = \ case
2427
+ KESAgentClientException _ ->
2428
+ Namespace [] [" KESAgentClientException" ]
2429
+ KESAgentClientTrace t -> nsCast $ namespaceFor t
2430
+
2431
+ severityFor (Namespace [] [" KESAgentClientException" ]) _ = Just Error
2432
+ severityFor (Namespace [] [" KESAgentClientTrace" ]) _ = Just Info
2433
+ severityFor _ _ = Nothing
2434
+
2435
+ documentFor _ = Nothing
2436
+
2437
+ allNamespaces =
2438
+ Namespace [] [" KESAgentClientException" ] :
2439
+ fmap nsCast (allNamespaces :: [Namespace Agent. ServiceClientTrace ])
0 commit comments