{-# LANGUAGE CPP                 #-}
{-# LANGUAGE LambdaCase          #-}
{-# LANGUAGE NamedFieldPuns      #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE PackageImports      #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications    #-}

--------------------------------------------------------------------------------

-- Orphan instances module for Cardano tracer.
{-# OPTIONS_GHC -Wno-orphans #-}
-- Extracted from "cardano-node" `Cardano.Node.Tracing.Tracers.Diffusion`.
-- Branch "master" (2026-02-11, 85869e9dd21d9dac7c4381418346e97259c3303b).

{-- TODO: All references to `ExnMempoolTimeout` were removed.
--        See all TODO annotations.
--}

--------------------------------------------------------------------------------

module Network.Mux.Tracing () where

--------------------------------------------------------------------------------

---------
-- base -
---------
import Data.List (isPrefixOf)
import Data.Typeable
---------------------
-- Package: "aeson" -
---------------------
import "aeson" Data.Aeson (Value (String), (.=))
--------------------------
-- Package: "formatting" -
--------------------------
import "formatting" Formatting
---------------------------
-- Package: "network-mux" -
---------------------------
import "network-mux" Network.Mux qualified as Mux
#ifdef linux_HOST_OS
import "network-mux" Network.Mux.TCPInfo (StructTCPInfo (..))
#endif
import "network-mux" Network.Mux.Types (SDUHeader (..), unRemoteClockModel)
--------------------
-- Package: "text" -
--------------------
import "text" Data.Text (Text)
--------------------------------
-- Package: "trace-dispatcher" -
--------------------------------
import "trace-dispatcher" Cardano.Logging

--------------------------------------------------------------------------------
-- Mux Tracer
--------------------------------------------------------------------------------

instance (LogFormatting peer, LogFormatting tr, Typeable tr) =>
    LogFormatting (Mux.WithBearer peer tr) where
    forMachine :: DetailLevel -> WithBearer peer tr -> Object
forMachine DetailLevel
dtal (Mux.WithBearer peer
b tr
ev) =
      [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind"   Key -> [Char] -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (TypeRep -> [Char]
forall a. Show a => a -> [Char]
show (TypeRep -> [Char]) -> (tr -> TypeRep) -> tr -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. tr -> TypeRep
forall a. Typeable a => a -> TypeRep
typeOf (tr -> [Char]) -> tr -> [Char]
forall a b. (a -> b) -> a -> b
$ tr
ev)
              , Key
"bearer" Key -> Object -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DetailLevel -> peer -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal peer
b
              , Key
"event"  Key -> Object -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DetailLevel -> tr -> Object
forall a. LogFormatting a => DetailLevel -> a -> Object
forMachine DetailLevel
dtal tr
ev ]
    forHuman :: WithBearer peer tr -> Text
forHuman (Mux.WithBearer peer
b tr
ev) = Text
"With mux bearer " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> peer -> Text
forall a. LogFormatting a => a -> Text
forHuman peer
b
                                      Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
". " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> tr -> Text
forall a. LogFormatting a => a -> Text
forHuman tr
ev

instance MetaTrace tr => MetaTrace (Mux.WithBearer peer tr) where
    namespaceFor :: WithBearer peer tr -> Namespace (WithBearer peer tr)
namespaceFor (Mux.WithBearer peer
_peer tr
obj) = (Namespace tr -> Namespace (WithBearer peer tr)
forall a b. Namespace a -> Namespace b
nsCast (Namespace tr -> Namespace (WithBearer peer tr))
-> (tr -> Namespace tr) -> tr -> Namespace (WithBearer peer tr)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. tr -> Namespace tr
forall a. MetaTrace a => a -> Namespace a
namespaceFor) tr
obj
    severityFor :: Namespace (WithBearer peer tr)
-> Maybe (WithBearer peer tr) -> Maybe SeverityS
severityFor Namespace (WithBearer peer tr)
ns Maybe (WithBearer peer tr)
Nothing = Namespace tr -> Maybe tr -> Maybe SeverityS
forall a. MetaTrace a => Namespace a -> Maybe a -> Maybe SeverityS
severityFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns :: Namespace tr) Maybe tr
forall a. Maybe a
Nothing
    severityFor Namespace (WithBearer peer tr)
ns (Just (Mux.WithBearer peer
_peer tr
obj)) =
      Namespace tr -> Maybe tr -> Maybe SeverityS
forall a. MetaTrace a => Namespace a -> Maybe a -> Maybe SeverityS
severityFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns) (tr -> Maybe tr
forall a. a -> Maybe a
Just tr
obj)
    privacyFor :: Namespace (WithBearer peer tr)
-> Maybe (WithBearer peer tr) -> Maybe Privacy
privacyFor Namespace (WithBearer peer tr)
ns Maybe (WithBearer peer tr)
Nothing = Namespace tr -> Maybe tr -> Maybe Privacy
forall a. MetaTrace a => Namespace a -> Maybe a -> Maybe Privacy
privacyFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns :: Namespace tr) Maybe tr
forall a. Maybe a
Nothing
    privacyFor Namespace (WithBearer peer tr)
ns (Just (Mux.WithBearer peer
_peer tr
obj)) =
      Namespace tr -> Maybe tr -> Maybe Privacy
forall a. MetaTrace a => Namespace a -> Maybe a -> Maybe Privacy
privacyFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns) (tr -> Maybe tr
forall a. a -> Maybe a
Just tr
obj)
    detailsFor :: Namespace (WithBearer peer tr)
-> Maybe (WithBearer peer tr) -> Maybe DetailLevel
detailsFor Namespace (WithBearer peer tr)
ns Maybe (WithBearer peer tr)
Nothing = Namespace tr -> Maybe tr -> Maybe DetailLevel
forall a.
MetaTrace a =>
Namespace a -> Maybe a -> Maybe DetailLevel
detailsFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns :: Namespace tr) Maybe tr
forall a. Maybe a
Nothing
    detailsFor Namespace (WithBearer peer tr)
ns (Just (Mux.WithBearer peer
_peer tr
obj)) =
      Namespace tr -> Maybe tr -> Maybe DetailLevel
forall a.
MetaTrace a =>
Namespace a -> Maybe a -> Maybe DetailLevel
detailsFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns) (tr -> Maybe tr
forall a. a -> Maybe a
Just tr
obj)
    documentFor :: Namespace (WithBearer peer tr) -> Maybe Text
documentFor Namespace (WithBearer peer tr)
ns = Namespace tr -> Maybe Text
forall a. MetaTrace a => Namespace a -> Maybe Text
documentFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns :: Namespace tr)
    metricsDocFor :: Namespace (WithBearer peer tr) -> [(Text, Text)]
metricsDocFor Namespace (WithBearer peer tr)
ns = Namespace tr -> [(Text, Text)]
forall a. MetaTrace a => Namespace a -> [(Text, Text)]
metricsDocFor (Namespace (WithBearer peer tr) -> Namespace tr
forall a b. Namespace a -> Namespace b
nsCast Namespace (WithBearer peer tr)
ns :: Namespace tr)
    allNamespaces :: [Namespace (WithBearer peer tr)]
allNamespaces = (Namespace tr -> Namespace (WithBearer peer tr))
-> [Namespace tr] -> [Namespace (WithBearer peer tr)]
forall a b. (a -> b) -> [a] -> [b]
map Namespace tr -> Namespace (WithBearer peer tr)
forall a b. Namespace a -> Namespace b
nsCast ([Namespace tr]
forall a. MetaTrace a => [Namespace a]
allNamespaces :: [Namespace tr])

instance LogFormatting Mux.BearerTrace where
    forMachine :: DetailLevel -> BearerTrace -> Object
forMachine DetailLevel
_dtal BearerTrace
Mux.TraceRecvHeaderStart = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvHeaderStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Receive Header Start"
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvHeaderEnd SDUHeader { RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp, MiniProtocolNum
mhNum :: MiniProtocolNum
mhNum :: SDUHeader -> MiniProtocolNum
mhNum, MiniProtocolDir
mhDir :: MiniProtocolDir
mhDir :: SDUHeader -> MiniProtocolDir
mhDir, Word16
mhLength :: Word16
mhLength :: SDUHeader -> Word16
mhLength }) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvHeaderStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.=  Text -> Value
String Text
"Bearer Receive Header End"
      , Key
"timestamp" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word32 -> Text
forall a. Integral a => a -> Text
showTHex (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp))
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mhNum)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
mhDir)
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word16 -> Text
forall a. Show a => a -> Text
showT Word16
mhLength)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvDeltaQObservation SDUHeader { RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp, Word16
mhLength :: SDUHeader -> Word16
mhLength :: Word16
mhLength } Time
ts) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvDeltaQObservation"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.=  Text -> Value
String Text
"Bearer DeltaQ observation"
      , Key
"timeRemote" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.=  Text -> Value
String (Time -> Text
forall a. Show a => a -> Text
showT Time
ts)
      , Key
"timeLocal" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word32 -> Text
forall a. Integral a => a -> Text
showTHex (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp))
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word16 -> Text
forall a. Show a => a -> Text
showT Word16
mhLength)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvDeltaQSample Double
d Int
sp Int
so Double
dqs Double
dqvm Double
dqvs Double
estR [Char]
sdud) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvDeltaQSample"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.=  Text -> Value
String Text
"Bearer DeltaQ Sample"
      , Key
"duration" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.=  Text -> Value
String (Double -> Text
forall a. Show a => a -> Text
showT Double
d)
      , Key
"packets" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
sp)
      , Key
"sumBytes" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
so)
      , Key
"DeltaQ_S" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Double -> Text
forall a. Show a => a -> Text
showT Double
dqs)
      , Key
"DeltaQ_VMean" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Double -> Text
forall a. Show a => a -> Text
showT Double
dqvm)
      , Key
"DeltaQ_VVar" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Double -> Text
forall a. Show a => a -> Text
showT Double
dqvs)
      , Key
"DeltaQ_estR" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Double -> Text
forall a. Show a => a -> Text
showT Double
estR)
      , Key
"sizeDist" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String ([Char] -> Text
forall a. Show a => a -> Text
showT [Char]
sdud)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvStart Int
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Receive Start"
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
len)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvRaw Int
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvRaw"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Receive Raw"
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
len)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceRecvEnd Int
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceRecvEnd"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Receive End"
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
len)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceSendStart SDUHeader { RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp, MiniProtocolNum
mhNum :: SDUHeader -> MiniProtocolNum
mhNum :: MiniProtocolNum
mhNum, MiniProtocolDir
mhDir :: SDUHeader -> MiniProtocolDir
mhDir :: MiniProtocolDir
mhDir, Word16
mhLength :: SDUHeader -> Word16
mhLength :: Word16
mhLength }) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceSendStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Send Start"
      , Key
"timestamp" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word32 -> Text
forall a. Integral a => a -> Text
showTHex (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp))
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mhNum)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
mhDir)
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Word16 -> Text
forall a. Show a => a -> Text
showT Word16
mhLength)
      ]
    forMachine DetailLevel
_dtal BearerTrace
Mux.TraceSendEnd = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceSendEnd"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Bearer Send End"
      ]
    forMachine DetailLevel
_dtal BearerTrace
Mux.TraceSDUReadTimeoutException = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceSDUReadTimeoutException"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Timed out reading SDU"
      ]
    forMachine DetailLevel
_dtal BearerTrace
Mux.TraceSDUWriteTimeoutException = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceSDUWriteTimeoutException"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Timed out writing SDU"
      ]
    forMachine DetailLevel
_dtal BearerTrace
Mux.TraceEmitDeltaQ = Object
forall a. Monoid a => a
mempty
#ifdef linux_HOST_OS
    forMachine DetailLevel
_dtal (Mux.TraceTCPInfo StructTCPInfo
            { CUInt
tcpi_snd_mss :: CUInt
tcpi_snd_mss :: StructTCPInfo -> CUInt
tcpi_snd_mss, CUInt
tcpi_rcv_mss :: CUInt
tcpi_rcv_mss :: StructTCPInfo -> CUInt
tcpi_rcv_mss, CUInt
tcpi_lost :: CUInt
tcpi_lost :: StructTCPInfo -> CUInt
tcpi_lost, CUInt
tcpi_retrans :: CUInt
tcpi_retrans :: StructTCPInfo -> CUInt
tcpi_retrans
            , CUInt
tcpi_rtt :: CUInt
tcpi_rtt :: StructTCPInfo -> CUInt
tcpi_rtt, CUInt
tcpi_rttvar :: CUInt
tcpi_rttvar :: StructTCPInfo -> CUInt
tcpi_rttvar, CUInt
tcpi_snd_cwnd :: CUInt
tcpi_snd_cwnd :: StructTCPInfo -> CUInt
tcpi_snd_cwnd }
            Word16
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceTCPInfo"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"TCPInfo"
      , Key
"rtt"  Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rtt :: Word)
      , Key
"rttvar" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rttvar :: Word)
      , Key
"snd_cwnd" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_snd_cwnd :: Word)
      , Key
"snd_mss" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_snd_mss :: Word)
      , Key
"rcv_mss" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rcv_mss :: Word)
      , Key
"lost" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_lost :: Word)
      , Key
"retrans" Key -> Word -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_retrans :: Word)
      , Key
"length" Key -> Word16 -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word16
len
      ]
#else
    forMachine _dtal (Mux.TraceTCPInfo _ len) = mconcat
      [ "kind" .= String "Mux.TraceTCPInfo"
      , "msg"  .= String "TCPInfo"
      , "len"  .= String (showT len)
      ]
#endif

    forHuman :: BearerTrace -> Text
forHuman BearerTrace
Mux.TraceRecvHeaderStart =
      Text
"Bearer Receive Header Start"
    forHuman (Mux.TraceRecvHeaderEnd SDUHeader { RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp, MiniProtocolNum
mhNum :: SDUHeader -> MiniProtocolNum
mhNum :: MiniProtocolNum
mhNum, MiniProtocolDir
mhDir :: SDUHeader -> MiniProtocolDir
mhDir :: MiniProtocolDir
mhDir, Word16
mhLength :: SDUHeader -> Word16
mhLength :: Word16
mhLength }) =
      Format
  Text
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text
forall a. Format Text a -> a
sformat (Format
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
"Bearer Receive Header End: ts:" Format
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
prefixHex Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
"(" Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolDir -> Word16 -> Text)
") " Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (MiniProtocolDir -> Word16 -> Text)
forall a r. Show a => Format r (a -> r)
shown Format (Word16 -> Text) (MiniProtocolDir -> Word16 -> Text)
-> Format Text (Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Word16 -> Text)
" len " Format (Word16 -> Text) (Word16 -> Text)
-> Format Text (Word16 -> Text) -> Format Text (Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int)
        (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp) MiniProtocolNum
mhNum MiniProtocolDir
mhDir Word16
mhLength
    forHuman (Mux.TraceRecvDeltaQObservation SDUHeader { RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp, Word16
mhLength :: SDUHeader -> Word16
mhLength :: Word16
mhLength } Time
ts) =
      Format Text (Word32 -> Time -> Word16 -> Text)
-> Word32 -> Time -> Word16 -> Text
forall a. Format Text a -> a
sformat (Format
  (Word32 -> Time -> Word16 -> Text)
  (Word32 -> Time -> Word16 -> Text)
"Bearer DeltaQ observation: remote ts" Format
  (Word32 -> Time -> Word16 -> Text)
  (Word32 -> Time -> Word16 -> Text)
-> Format Text (Word32 -> Time -> Word16 -> Text)
-> Format Text (Word32 -> Time -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Time -> Word16 -> Text) (Word32 -> Time -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format (Time -> Word16 -> Text) (Word32 -> Time -> Word16 -> Text)
-> Format Text (Time -> Word16 -> Text)
-> Format Text (Word32 -> Time -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Time -> Word16 -> Text) (Time -> Word16 -> Text)
" local ts " Format (Time -> Word16 -> Text) (Time -> Word16 -> Text)
-> Format Text (Time -> Word16 -> Text)
-> Format Text (Time -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Time -> Word16 -> Text)
forall a r. Show a => Format r (a -> r)
shown Format (Word16 -> Text) (Time -> Word16 -> Text)
-> Format Text (Word16 -> Text)
-> Format Text (Time -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Word16 -> Text)
" length " Format (Word16 -> Text) (Word16 -> Text)
-> Format Text (Word16 -> Text) -> Format Text (Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int)
         (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp) Time
ts Word16
mhLength
    forHuman (Mux.TraceRecvDeltaQSample Double
d Int
sp Int
so Double
dqs Double
dqvm Double
dqvs Double
estR [Char]
sdud) =
      Format
  Text
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
-> Double
-> Int
-> Int
-> Double
-> Double
-> Double
-> Double
-> [Char]
-> Text
forall a. Format Text a -> a
sformat (Format
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
"Bearer DeltaQ Sample: duration " Format
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
-> Format
     Text
     (Double
      -> Int
      -> Int
      -> Double
      -> Double
      -> Double
      -> Double
      -> [Char]
      -> Text)
-> Format
     Text
     (Double
      -> Int
      -> Int
      -> Double
      -> Double
      -> Double
      -> Double
      -> [Char]
      -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Int
-> Format
     (Int
      -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
     (Double
      -> Int
      -> Int
      -> Double
      -> Double
      -> Double
      -> Double
      -> [Char]
      -> Text)
forall a r. Real a => Int -> Format r (a -> r)
fixed Int
3 Format
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Double
   -> Int
   -> Int
   -> Double
   -> Double
   -> Double
   -> Double
   -> [Char]
   -> Text)
-> Format
     Text
     (Int
      -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Double
      -> Int
      -> Int
      -> Double
      -> Double
      -> Double
      -> Double
      -> [Char]
      -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
" packets " Format
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int
      -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int
      -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int
   -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int
      -> Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
" sumBytes "
        Format
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Double -> Double -> Double -> Double -> [Char] -> Text)
  (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text (Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text
     (Int -> Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Double -> Double -> Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> Double -> [Char] -> Text)
" DeltaQ_S " Format
  (Double -> Double -> Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text (Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text (Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Int
-> Format
     (Double -> Double -> Double -> [Char] -> Text)
     (Double -> Double -> Double -> Double -> [Char] -> Text)
forall a r. Real a => Int -> Format r (a -> r)
fixed Int
3 Format
  (Double -> Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> Double -> [Char] -> Text)
-> Format
     Text (Double -> Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Double -> Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> [Char] -> Text)
" DeltaQ_VMean " Format
  (Double -> Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Int
-> Format
     (Double -> Double -> [Char] -> Text)
     (Double -> Double -> Double -> [Char] -> Text)
forall a r. Real a => Int -> Format r (a -> r)
fixed Int
3 Format
  (Double -> Double -> [Char] -> Text)
  (Double -> Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Double -> Double -> [Char] -> Text)
  (Double -> Double -> [Char] -> Text)
"DeltaQ_VVar " Format
  (Double -> Double -> [Char] -> Text)
  (Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> [Char] -> Text)
-> Format Text (Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Int
-> Format
     (Double -> [Char] -> Text) (Double -> Double -> [Char] -> Text)
forall a r. Real a => Int -> Format r (a -> r)
fixed Int
3
        Format
  (Double -> [Char] -> Text) (Double -> Double -> [Char] -> Text)
-> Format Text (Double -> [Char] -> Text)
-> Format Text (Double -> Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Double -> [Char] -> Text) (Double -> [Char] -> Text)
" DeltaQ_estR " Format (Double -> [Char] -> Text) (Double -> [Char] -> Text)
-> Format Text (Double -> [Char] -> Text)
-> Format Text (Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Int -> Format ([Char] -> Text) (Double -> [Char] -> Text)
forall a r. Real a => Int -> Format r (a -> r)
fixed Int
3 Format ([Char] -> Text) (Double -> [Char] -> Text)
-> Format Text ([Char] -> Text)
-> Format Text (Double -> [Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format ([Char] -> Text) ([Char] -> Text)
" sizeDist " Format ([Char] -> Text) ([Char] -> Text)
-> Format Text ([Char] -> Text) -> Format Text ([Char] -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text ([Char] -> Text)
forall r. Format r ([Char] -> r)
string)
        Double
d Int
sp Int
so Double
dqs Double
dqvm Double
dqvs Double
estR [Char]
sdud
    forHuman (Mux.TraceRecvStart Int
len) =
      Format Text (Int -> Text) -> Int -> Text
forall a. Format Text a -> a
sformat (Format (Int -> Text) (Int -> Text)
"Bearer Receive Start: length " Format (Int -> Text) (Int -> Text)
-> Format Text (Int -> Text) -> Format Text (Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Int -> Text)
forall a r. Integral a => Format r (a -> r)
int) Int
len
    forHuman (Mux.TraceRecvRaw Int
len) =
      Format Text (Int -> Text) -> Int -> Text
forall a. Format Text a -> a
sformat (Format (Int -> Text) (Int -> Text)
"Bearer Receive Raw: length " Format (Int -> Text) (Int -> Text)
-> Format Text (Int -> Text) -> Format Text (Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Int -> Text)
forall a r. Integral a => Format r (a -> r)
int) Int
len
    forHuman (Mux.TraceRecvEnd Int
len) =
      Format Text (Int -> Text) -> Int -> Text
forall a. Format Text a -> a
sformat (Format (Int -> Text) (Int -> Text)
"Bearer Receive End: length " Format (Int -> Text) (Int -> Text)
-> Format Text (Int -> Text) -> Format Text (Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Int -> Text)
forall a r. Integral a => Format r (a -> r)
int) Int
len
    forHuman (Mux.TraceSendStart SDUHeader { RemoteClockModel
mhTimestamp :: SDUHeader -> RemoteClockModel
mhTimestamp :: RemoteClockModel
mhTimestamp, MiniProtocolNum
mhNum :: SDUHeader -> MiniProtocolNum
mhNum :: MiniProtocolNum
mhNum, MiniProtocolDir
mhDir :: SDUHeader -> MiniProtocolDir
mhDir :: MiniProtocolDir
mhDir, Word16
mhLength :: SDUHeader -> Word16
mhLength :: Word16
mhLength }) =
      Format
  Text
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text
forall a. Format Text a -> a
sformat (Format
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
"Bearer Send Start: ts: " Format
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
prefixHex Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text
     (Word32 -> MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
" (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolDir -> Word16 -> Text)
") " Format
  (MiniProtocolDir -> Word16 -> Text)
  (MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (MiniProtocolDir -> Word16 -> Text)
forall a r. Show a => Format r (a -> r)
shown Format (Word16 -> Text) (MiniProtocolDir -> Word16 -> Text)
-> Format Text (Word16 -> Text)
-> Format Text (MiniProtocolDir -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Word16 -> Text)
" length " Format (Word16 -> Text) (Word16 -> Text)
-> Format Text (Word16 -> Text) -> Format Text (Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int)
        (RemoteClockModel -> Word32
unRemoteClockModel RemoteClockModel
mhTimestamp) MiniProtocolNum
mhNum MiniProtocolDir
mhDir Word16
mhLength
    forHuman BearerTrace
Mux.TraceSendEnd =
      Text
"Bearer Send End"
    forHuman BearerTrace
Mux.TraceSDUReadTimeoutException =
      Text
"Timed out reading SDU"
    forHuman BearerTrace
Mux.TraceSDUWriteTimeoutException =
      Text
"Timed out writing SDU"
    forHuman BearerTrace
Mux.TraceEmitDeltaQ = Text
forall a. Monoid a => a
mempty
#ifdef linux_HOST_OS
    forHuman (Mux.TraceTCPInfo StructTCPInfo
            { CUInt
tcpi_snd_mss :: StructTCPInfo -> CUInt
tcpi_snd_mss :: CUInt
tcpi_snd_mss, CUInt
tcpi_rcv_mss :: StructTCPInfo -> CUInt
tcpi_rcv_mss :: CUInt
tcpi_rcv_mss, CUInt
tcpi_lost :: StructTCPInfo -> CUInt
tcpi_lost :: CUInt
tcpi_lost, CUInt
tcpi_retrans :: StructTCPInfo -> CUInt
tcpi_retrans :: CUInt
tcpi_retrans
            , CUInt
tcpi_rtt :: StructTCPInfo -> CUInt
tcpi_rtt :: CUInt
tcpi_rtt, CUInt
tcpi_rttvar :: StructTCPInfo -> CUInt
tcpi_rttvar :: CUInt
tcpi_rttvar, CUInt
tcpi_snd_cwnd :: StructTCPInfo -> CUInt
tcpi_snd_cwnd :: CUInt
tcpi_snd_cwnd }
            Word16
len) =
      Format
  Text
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Word
-> Word
-> Word
-> Word
-> Word
-> Word
-> Word
-> Word16
-> Text
forall a. Format Text a -> a
sformat (Format
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
"TCPInfo rtt " Format
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word
      -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word
      -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word
   -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word
      -> Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
" rttvar " Format
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text
     (Word -> Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
" snd_cwnd " Format
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format
     Text (Word -> Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
%
               Format
  (Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word16 -> Text)
" snd_mss " Format
  (Word -> Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word16 -> Text)
" rcv_mss " Format
  (Word -> Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format
  (Word -> Word -> Word16 -> Text)
  (Word -> Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (Word -> Word -> Word16 -> Text) (Word -> Word -> Word16 -> Text)
" lost " Format
  (Word -> Word -> Word16 -> Text) (Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word -> Word16 -> Text) (Word -> Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format (Word -> Word16 -> Text) (Word -> Word -> Word16 -> Text)
-> Format Text (Word -> Word16 -> Text)
-> Format Text (Word -> Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
%
               Format (Word -> Word16 -> Text) (Word -> Word16 -> Text)
" retrans " Format (Word -> Word16 -> Text) (Word -> Word16 -> Text)
-> Format Text (Word -> Word16 -> Text)
-> Format Text (Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Word -> Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int Format (Word16 -> Text) (Word -> Word16 -> Text)
-> Format Text (Word16 -> Text)
-> Format Text (Word -> Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Word16 -> Text) (Word16 -> Text)
" len " Format (Word16 -> Text) (Word16 -> Text)
-> Format Text (Word16 -> Text) -> Format Text (Word16 -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Word16 -> Text)
forall a r. Integral a => Format r (a -> r)
int)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rtt :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rttvar :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_snd_cwnd :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_snd_mss :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_rcv_mss :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_lost :: Word)
              (CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
tcpi_retrans :: Word)
              Word16
len
#else
    forHuman (Mux.TraceTCPInfo _ len) = sformat ("TCPInfo len " % int) len
#endif

instance MetaTrace Mux.BearerTrace where
    namespaceFor :: BearerTrace -> Namespace BearerTrace
namespaceFor Mux.TraceRecvHeaderStart {}       =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvHeaderStart"]
    namespaceFor Mux.TraceRecvHeaderEnd {}         =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvHeaderEnd"]
    namespaceFor Mux.TraceRecvStart {}             =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvStart"]
    namespaceFor Mux.TraceRecvRaw {}               =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvRaw"]
    namespaceFor Mux.TraceRecvEnd {}               =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvEnd"]
    namespaceFor Mux.TraceSendStart {}             =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SendStart"]
    namespaceFor BearerTrace
Mux.TraceSendEnd                  =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SendEnd"]
    namespaceFor Mux.TraceRecvDeltaQObservation {} =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvDeltaQObservation"]
    namespaceFor Mux.TraceRecvDeltaQSample {}      =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvDeltaQSample"]
    namespaceFor BearerTrace
Mux.TraceSDUReadTimeoutException  =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SDUReadTimeoutException"]
    namespaceFor BearerTrace
Mux.TraceSDUWriteTimeoutException =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SDUWriteTimeoutException"]
    namespaceFor BearerTrace
Mux.TraceEmitDeltaQ               =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TraceEmitDeltaQ"]
    namespaceFor Mux.TraceTCPInfo {}               =
      [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TCPInfo"]

    severityFor :: Namespace BearerTrace -> Maybe BearerTrace -> Maybe SeverityS
severityFor (Namespace [Text]
_ [Text
"RecvHeaderStart"]) Maybe BearerTrace
_          = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvRaw"]) Maybe BearerTrace
_                  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvHeaderEnd"]) Maybe BearerTrace
_            = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvStart"]) Maybe BearerTrace
_                = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvEnd"]) Maybe BearerTrace
_                  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"SendStart"]) Maybe BearerTrace
_                = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"SendEnd"]) Maybe BearerTrace
_                  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvDeltaQObservation"]) Maybe BearerTrace
_    = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"RecvDeltaQSample"]) Maybe BearerTrace
_         = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"SDUReadTimeoutException"]) Maybe BearerTrace
_  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
    severityFor (Namespace [Text]
_ [Text
"SDUWriteTimeoutException"]) Maybe BearerTrace
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
    severityFor (Namespace [Text]
_ [Text
"TCPInfo"]) Maybe BearerTrace
_                  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"TraceEmitDeltaQ"]) Maybe BearerTrace
_          = Maybe SeverityS
forall a. Maybe a
Nothing
    severityFor Namespace BearerTrace
_ Maybe BearerTrace
_                                          = Maybe SeverityS
forall a. Maybe a
Nothing

    documentFor :: Namespace BearerTrace -> Maybe Text
documentFor (Namespace [Text]
_ [Text
"RecvHeaderStart"])       = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer receive header start."
    documentFor (Namespace [Text]
_ [Text
"RecvRaw"])               = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer receive raw."
    documentFor (Namespace [Text]
_ [Text
"RecvHeaderEnd"])         = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer receive header end."
    documentFor (Namespace [Text]
_ [Text
"RecvStart"])             = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer receive start."
    documentFor (Namespace [Text]
_ [Text
"RecvEnd"])               = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer receive end."
    documentFor (Namespace [Text]
_ [Text
"SendStart"])             = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer send start."
    documentFor (Namespace [Text]
_ [Text
"SendEnd"])               = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer send end."
    documentFor (Namespace [Text]
_ [Text
"RecvDeltaQObservation"]) = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer DeltaQ observation."
    documentFor (Namespace [Text]
_ [Text
"RecvDeltaQSample"])      = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Bearer DeltaQ sample."
    documentFor (Namespace [Text]
_ [Text
"SDUReadTimeoutException"])  = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Timed out reading SDU."
    documentFor (Namespace [Text]
_ [Text
"SDUWriteTimeoutException"]) = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Timed out writing SDU."
    documentFor (Namespace [Text]
_ [Text
"TraceEmitDeltaQ"])       = Maybe Text
forall a. Maybe a
Nothing
    documentFor (Namespace [Text]
_ [Text
"TCPInfo"])               = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"TCPInfo."
    documentFor Namespace BearerTrace
_                                       = Maybe Text
forall a. Maybe a
Nothing

    allNamespaces :: [Namespace BearerTrace]
allNamespaces = [
        [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvHeaderStart"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvRaw"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvHeaderEnd"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvStart"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvEnd"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SendStart"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SendEnd"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvDeltaQObservation"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"RecvDeltaQSample"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SDUReadTimeoutException"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"SDUWriteTimeoutException"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TraceEmitDeltaQ"]
      , [Text] -> [Text] -> Namespace BearerTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TCPInfo"]
      ]

instance LogFormatting Mux.ChannelTrace where
    forMachine :: DetailLevel -> ChannelTrace -> Object
forMachine DetailLevel
_dtal (Mux.TraceChannelRecvStart MiniProtocolNum
mid) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceChannelRecvStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Channel Receive Start"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceChannelRecvEnd MiniProtocolNum
mid Int
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceChannelRecvEnd"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Channel Receive End"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
len)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceChannelSendStart MiniProtocolNum
mid Int
len) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceChannelSendStart"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Channel Send Start"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"length" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (Int -> Text
forall a. Show a => a -> Text
showT Int
len)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceChannelSendEnd MiniProtocolNum
mid) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceChannelSendEnd"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Channel Send End"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      ]

    forHuman :: ChannelTrace -> Text
forHuman (Mux.TraceChannelRecvStart MiniProtocolNum
mid) =
      Format Text (MiniProtocolNum -> Text) -> MiniProtocolNum -> Text
forall a. Format Text a -> a
sformat (Format (MiniProtocolNum -> Text) (MiniProtocolNum -> Text)
"Channel Receive Start on " Format (MiniProtocolNum -> Text) (MiniProtocolNum -> Text)
-> Format Text (MiniProtocolNum -> Text)
-> Format Text (MiniProtocolNum -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolNum -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid
    forHuman (Mux.TraceChannelRecvEnd MiniProtocolNum
mid Int
len) =
      Format Text (MiniProtocolNum -> Int -> Text)
-> MiniProtocolNum -> Int -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> Int -> Text) (MiniProtocolNum -> Int -> Text)
"Channel Receive End on (" Format
  (MiniProtocolNum -> Int -> Text) (MiniProtocolNum -> Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Int -> Text) (MiniProtocolNum -> Int -> Text)
forall a r. Show a => Format r (a -> r)
shown Format (Int -> Text) (MiniProtocolNum -> Int -> Text)
-> Format Text (Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Int -> Text) (Int -> Text)
") " Format (Int -> Text) (Int -> Text)
-> Format Text (Int -> Text) -> Format Text (Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Int -> Text)
forall a r. Integral a => Format r (a -> r)
int) MiniProtocolNum
mid Int
len
    forHuman (Mux.TraceChannelSendStart MiniProtocolNum
mid Int
len) =
      Format Text (MiniProtocolNum -> Int -> Text)
-> MiniProtocolNum -> Int -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> Int -> Text) (MiniProtocolNum -> Int -> Text)
"Channel Send Start on (" Format
  (MiniProtocolNum -> Int -> Text) (MiniProtocolNum -> Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Int -> Text) (MiniProtocolNum -> Int -> Text)
forall a r. Show a => Format r (a -> r)
shown Format (Int -> Text) (MiniProtocolNum -> Int -> Text)
-> Format Text (Int -> Text)
-> Format Text (MiniProtocolNum -> Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (Int -> Text) (Int -> Text)
") " Format (Int -> Text) (Int -> Text)
-> Format Text (Int -> Text) -> Format Text (Int -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (Int -> Text)
forall a r. Integral a => Format r (a -> r)
int) MiniProtocolNum
mid Int
len
    forHuman (Mux.TraceChannelSendEnd MiniProtocolNum
mid) =
      Format Text (MiniProtocolNum -> Text) -> MiniProtocolNum -> Text
forall a. Format Text a -> a
sformat (Format (MiniProtocolNum -> Text) (MiniProtocolNum -> Text)
"Channel Send End on " Format (MiniProtocolNum -> Text) (MiniProtocolNum -> Text)
-> Format Text (MiniProtocolNum -> Text)
-> Format Text (MiniProtocolNum -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolNum -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid

instance MetaTrace Mux.ChannelTrace where
    namespaceFor :: ChannelTrace -> Namespace ChannelTrace
namespaceFor Mux.TraceChannelRecvStart {}      =
      [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelRecvStart"]
    namespaceFor Mux.TraceChannelRecvEnd {}        =
      [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelRecvEnd"]
    namespaceFor Mux.TraceChannelSendStart {}      =
      [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelSendStart"]
    namespaceFor Mux.TraceChannelSendEnd {}        =
      [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelSendEnd"]

    severityFor :: Namespace ChannelTrace -> Maybe ChannelTrace -> Maybe SeverityS
severityFor (Namespace [Text]
_ [Text
"ChannelRecvStart"]) Maybe ChannelTrace
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"ChannelRecvEnd"]) Maybe ChannelTrace
_   = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"ChannelSendStart"]) Maybe ChannelTrace
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"ChannelSendEnd"]) Maybe ChannelTrace
_   = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor Namespace ChannelTrace
_ Maybe ChannelTrace
_                                  = Maybe SeverityS
forall a. Maybe a
Nothing

    documentFor :: Namespace ChannelTrace -> Maybe Text
documentFor (Namespace [Text]
_ [Text
"ChannelRecvStart"])      = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Channel receive start."
    documentFor (Namespace [Text]
_ [Text
"ChannelRecvEnd"])        = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Channel receive end."
    documentFor (Namespace [Text]
_ [Text
"ChannelSendStart"])      = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Channel send start."
    documentFor (Namespace [Text]
_ [Text
"ChannelSendEnd"])        = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Channel send end."
    documentFor Namespace ChannelTrace
_                                       = Maybe Text
forall a. Maybe a
Nothing

    allNamespaces :: [Namespace ChannelTrace]
allNamespaces = [
        [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelRecvStart"]
      , [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelRecvEnd"]
      , [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelSendStart"]
      , [Text] -> [Text] -> Namespace ChannelTrace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ChannelSendEnd"]
      ]

txsMempoolTimeoutHardCounterName :: Text
txsMempoolTimeoutHardCounterName :: Text
txsMempoolTimeoutHardCounterName = Text
"txsMempoolTimeoutHard"

impliesMempoolTimeoutHard :: Mux.Trace -> Bool
impliesMempoolTimeoutHard :: Trace -> Bool
impliesMempoolTimeoutHard = \case
  Mux.TraceExceptionExit MiniProtocolNum
_mid MiniProtocolDir
_dir SomeException
e
{-- TODO: In cardano-node master this is implemented as:
 --
 -- > | Just _ <- fromException @ExnMempoolTimeout e
 -- >   -> True
 --
 -- but `ExnMempoolTimeout` is defined in `ouroboros-consensus` which is not a
 -- dependency of `ouroboros-network`.
 --}
    | [Char] -> [Char] -> Bool
forall a. Eq a => [a] -> [a] -> Bool
isPrefixOf [Char]
"ExnMempoolTimeout " (SomeException -> [Char]
forall a. Show a => a -> [Char]
show SomeException
e) -> Bool
True
  Trace
_ -> Bool
False

instance LogFormatting Mux.Trace where
    forMachine :: DetailLevel -> Trace -> Object
forMachine DetailLevel
_dtal (Mux.TraceState State
new) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceState"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MuxState"
      , Key
"state" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (State -> Text
forall a. Show a => a -> Text
showT State
new)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceCleanExit MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceCleanExit"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Miniprotocol terminated cleanly"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceExceptionExit MiniProtocolNum
mid MiniProtocolDir
dir SomeException
exc) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceExceptionExit"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Miniprotocol terminated with exception"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      , Key
"exception" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (SomeException -> Text
forall a. Show a => a -> Text
showT SomeException
exc)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceStartEagerly MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStartEagerly"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Eagerly started"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceStartOnDemand MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStartOnDemand"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Preparing to start"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceStartOnDemandAny MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStartOnDemandAny"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Preparing to start"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceStartedOnDemand MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStartedOnDemand"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Started on demand"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceTerminating MiniProtocolNum
mid MiniProtocolDir
dir) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceTerminating"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Terminating"
      , Key
"miniProtocolNum" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolNum -> Text
forall a. Show a => a -> Text
showT MiniProtocolNum
mid)
      , Key
"miniProtocolDir" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (MiniProtocolDir -> Text
forall a. Show a => a -> Text
showT MiniProtocolDir
dir)
      ]
    forMachine DetailLevel
_dtal (Mux.TraceNewMux [MiniProtocolInfo mode]
_) = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceNewMux"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"New Mux"
      ]
    forMachine DetailLevel
_dtal Trace
Mux.TraceStarting = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceSarting"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux starting"
      ]
    forMachine DetailLevel
_dtal Trace
Mux.TraceStopping = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStopping"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux stopping"
      ]
    forMachine DetailLevel
_dtal Trace
Mux.TraceStopped = [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux.TraceStopped"
      , Key
"msg"  Key -> Value -> Object
forall v. ToJSON v => Key -> v -> Object
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"Mux stoppped"
      ]

    forHuman :: Trace -> Text
forHuman (Mux.TraceState State
new) =
      Format Text (State -> Text) -> State -> Text
forall a. Format Text a -> a
sformat (Format (State -> Text) (State -> Text)
"State: " Format (State -> Text) (State -> Text)
-> Format Text (State -> Text) -> Format Text (State -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (State -> Text)
forall a r. Show a => Format r (a -> r)
shown) State
new
    forHuman (Mux.TraceCleanExit MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Miniprotocol (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format Text (MiniProtocolDir -> Text)
-> Format Text Text -> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text Text
" terminated cleanly")
      MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceExceptionExit MiniProtocolNum
mid MiniProtocolDir
dir SomeException
e) =
      Format
  Text (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
"Miniprotocol (" Format
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
-> Format Text (MiniProtocolDir -> SomeException -> Text)
-> Format
     Text (MiniProtocolNum -> MiniProtocolDir -> SomeException -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolDir -> SomeException -> Text)
") " Format
  (MiniProtocolDir -> SomeException -> Text)
  (MiniProtocolDir -> SomeException -> Text)
-> Format Text (MiniProtocolDir -> SomeException -> Text)
-> Format Text (MiniProtocolDir -> SomeException -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (SomeException -> Text) (MiniProtocolDir -> SomeException -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (SomeException -> Text) (MiniProtocolDir -> SomeException -> Text)
-> Format Text (SomeException -> Text)
-> Format Text (MiniProtocolDir -> SomeException -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
%
        Format (SomeException -> Text) (SomeException -> Text)
" terminated with exception " Format (SomeException -> Text) (SomeException -> Text)
-> Format Text (SomeException -> Text)
-> Format Text (SomeException -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (SomeException -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir SomeException
e
    forHuman (Mux.TraceStartEagerly MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Eagerly started (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") in " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceStartOnDemand MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Preparing to start (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") in " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceStartOnDemandAny MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Preparing to start (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") in " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceStartedOnDemand MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Started on demand (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") in " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceTerminating MiniProtocolNum
mid MiniProtocolDir
dir) =
      Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> MiniProtocolNum -> MiniProtocolDir -> Text
forall a. Format Text a -> a
sformat (Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
"Terminating (" Format
  (MiniProtocolNum -> MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown Format
  (MiniProtocolDir -> Text)
  (MiniProtocolNum -> MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolNum -> MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
") in " Format (MiniProtocolDir -> Text) (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
-> Format Text (MiniProtocolDir -> Text)
forall r a r'. Format r a -> Format r' r -> Format r' a
% Format Text (MiniProtocolDir -> Text)
forall a r. Show a => Format r (a -> r)
shown) MiniProtocolNum
mid MiniProtocolDir
dir
    forHuman (Mux.TraceNewMux [MiniProtocolInfo mode]
_) = Text
"New Mux"
    forHuman Trace
Mux.TraceStarting = Text
"Mux Starting"
    forHuman Trace
Mux.TraceStopping = Text
"Mux stopping"
    forHuman Trace
Mux.TraceStopped = Text
"Mux stoppped"

    asMetrics :: Trace -> [Metric]
asMetrics = \case
      Mux.TraceState{} -> []
      Mux.TraceCleanExit{} -> []
      ev :: Trace
ev@Mux.TraceExceptionExit{} ->
        -- Somewhat awkward to "catch" this Consensus exception here, but
        -- Diffusion Layer is indeed the ultimate manager of the per-peer
        -- threads.
        [ Text -> Maybe Int -> Metric
CounterM Text
txsMempoolTimeoutHardCounterName Maybe Int
forall a. Maybe a
Nothing
        | Trace -> Bool
impliesMempoolTimeoutHard Trace
ev
        ]
      Mux.TraceStartEagerly{} -> []
      Mux.TraceStartOnDemand{} -> []
      Mux.TraceStartOnDemandAny{} -> []
      Mux.TraceStartedOnDemand{} -> []
      Mux.TraceTerminating{} -> []
      Mux.TraceNewMux{} -> []
      Mux.TraceStarting{} -> []
      Mux.TraceStopping{} -> []
      Mux.TraceStopped{} -> []

instance MetaTrace Mux.Trace where
    namespaceFor :: Trace -> Namespace Trace
namespaceFor Mux.TraceState {}                 =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"State"]
    namespaceFor Mux.TraceCleanExit {}             =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"CleanExit"]
    namespaceFor Mux.TraceExceptionExit {}         =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ExceptionExit"]
    namespaceFor Mux.TraceStartEagerly {}          =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartEagerly"]
    namespaceFor Mux.TraceStartOnDemand {}         =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartOnDemand"]
    namespaceFor Mux.TraceStartOnDemandAny {}      =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartOnDemandAny"]
    namespaceFor Mux.TraceStartedOnDemand {}       =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartedOnDemand"]
    namespaceFor Mux.TraceTerminating {}           =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Terminating"]
    namespaceFor (Mux.TraceNewMux [MiniProtocolInfo mode]
_)               =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"NewMux"]
    namespaceFor Trace
Mux.TraceStarting                 =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Starting"]
    namespaceFor Trace
Mux.TraceStopping                 =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Stopping"]
    namespaceFor Trace
Mux.TraceStopped                  =
      [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Stopped"]

    severityFor :: Namespace Trace -> Maybe Trace -> Maybe SeverityS
severityFor (Namespace [Text]
_ [Text
"State"]) Maybe Trace
_            = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Info
    severityFor (Namespace [Text]
_ [Text
"CleanExit"]) Maybe Trace
_        = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
    severityFor (Namespace [Text]
_ [Text
"ExceptionExit"]) Maybe Trace
_    = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
    severityFor (Namespace [Text]
_ [Text
"StartEagerly"]) Maybe Trace
_     = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"StartOnDemand"]) Maybe Trace
_    = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"StartOnDemandAny"]) Maybe Trace
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"StartedOnDemand"]) Maybe Trace
_  = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"Terminating"]) Maybe Trace
_      = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"NewMux"]) Maybe Trace
_           = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"Starting"]) Maybe Trace
_         = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"Stopping"]) Maybe Trace
_         = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor (Namespace [Text]
_ [Text
"Stopped"]) Maybe Trace
_          = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
    severityFor Namespace Trace
_ Maybe Trace
_                                  = Maybe SeverityS
forall a. Maybe a
Nothing

    documentFor :: Namespace Trace -> Maybe Text
documentFor (Namespace [Text]
_ [Text
"State"])                 = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"State."
    documentFor (Namespace [Text]
_ [Text
"CleanExit"])             = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Miniprotocol terminated cleanly."
    documentFor (Namespace [Text]
_ [Text
"ExceptionExit"])         = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Miniprotocol terminated with exception."
    documentFor (Namespace [Text]
_ [Text
"StartEagerly"])          = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Eagerly started."
    documentFor (Namespace [Text]
_ [Text
"StartOnDemand"])         = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Preparing to start."
    documentFor (Namespace [Text]
_ [Text
"StartedOnDemand"])       = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Started on demand."
    documentFor (Namespace [Text]
_ [Text
"StartOnDemandAny"])      = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Start whenever any other protocol has started."
    documentFor (Namespace [Text]
_ [Text
"Terminating"])           = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Terminating."
    documentFor (Namespace [Text]
_ [Text
"NewMux"])                = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"New Mux"
    documentFor (Namespace [Text]
_ [Text
"Starting"])              = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Mux Starting"
    documentFor (Namespace [Text]
_ [Text
"Stopping"])              = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Mux shutdown."
    documentFor (Namespace [Text]
_ [Text
"Stopped"])               = Text -> Maybe Text
forall a. a -> Maybe a
Just
      Text
"Mux shutdown."
    documentFor Namespace Trace
_ = Maybe Text
forall a. Maybe a
Nothing

    metricsDocFor :: Namespace Trace -> [(Text, Text)]
metricsDocFor (Namespace [Text]
_ [Text
"State"])               = []
    metricsDocFor (Namespace [Text]
_ [Text
"CleanExit"])           = []
    metricsDocFor (Namespace [Text]
_ [Text
"ExceptionExit"])       =
      [ (Text
txsMempoolTimeoutHardCounterName, Text
"Transactions that hard timed out in mempool")
      ]
    metricsDocFor (Namespace [Text]
_ [Text
"StartEagerly"])        = []
    metricsDocFor (Namespace [Text]
_ [Text
"StartOnDemand"])       = []
    metricsDocFor (Namespace [Text]
_ [Text
"StartedOnDemand"])     = []
    metricsDocFor (Namespace [Text]
_ [Text
"StartOnDemandAny"])    = []
    metricsDocFor (Namespace [Text]
_ [Text
"Terminating"])         = []
    metricsDocFor (Namespace [Text]
_ [Text
"NewMux"])              = []
    metricsDocFor (Namespace [Text]
_ [Text
"Starting"])            = []
    metricsDocFor (Namespace [Text]
_ [Text
"Stopping"])            = []
    metricsDocFor (Namespace [Text]
_ [Text
"Stopped"])             = []
    metricsDocFor Namespace Trace
_                                     = []

    allNamespaces :: [Namespace Trace]
allNamespaces = [
        [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"State"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"CleanExit"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"ExceptionExit"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartEagerly"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartOnDemand"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartOnDemandAny"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"StartedOnDemand"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Terminating"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"NewMux"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Starting"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Stopping"]
      , [Text] -> [Text] -> Namespace Trace
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"Stopped"]
      ]