{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Ouroboros.Consensus.Tracing.LeiosFetch () where
import Cardano.Crypto.Hash (hashToStringAsHex)
import Cardano.Logging
import Control.Exception (displayException)
import Data.Aeson (Value (String), (.=))
import qualified Data.Aeson as Aeson
import qualified Data.Text as Text
import Ouroboros.Consensus.Block (SlotNo (..))
import Ouroboros.Consensus.Leios.Types (LeiosPoint (..), prettyLeiosPoint)
import Ouroboros.Consensus.MiniProtocol.LeiosFetch.Server (ExnLeiosInvalidRequest (..))
import Ouroboros.Consensus.MiniProtocol.LeiosFetch.Trace
( FetchArrivalBytes (..)
, TraceLeiosFetchClientEvent (..)
, TraceLeiosFetchServerEvent (..)
)
instance
(LogFormatting peer, Show peer) =>
LogFormatting (TraceLeiosFetchClientEvent peer)
where
forMachine :: DetailLevel -> TraceLeiosFetchClientEvent peer -> KeyMap Value
forMachine DetailLevel
dtal = \case
TraceLeiosFetchClientBlockArrived peer
peer LeiosPoint
point FetchArrivalBytes
arrival ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockArrived"
, Key
"peer" Key -> KeyMap Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DetailLevel -> peer -> KeyMap Value
forall a. LogFormatting a => DetailLevel -> a -> KeyMap Value
forMachine DetailLevel
dtal peer
peer
, LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point
, FetchArrivalBytes -> KeyMap Value
forall {a} {e}. (Monoid a, KeyValue e a) => FetchArrivalBytes -> a
arrivalFields FetchArrivalBytes
arrival
]
TraceLeiosFetchClientTxsArrived peer
peer LeiosPoint
point FetchArrivalBytes
arrival ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"TxsArrived"
, Key
"peer" Key -> KeyMap Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DetailLevel -> peer -> KeyMap Value
forall a. LogFormatting a => DetailLevel -> a -> KeyMap Value
forMachine DetailLevel
dtal peer
peer
, LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point
, FetchArrivalBytes -> KeyMap Value
forall {a} {e}. (Monoid a, KeyValue e a) => FetchArrivalBytes -> a
arrivalFields FetchArrivalBytes
arrival
]
TraceLeiosFetchClientBlockAcquired LeiosPoint
point Maybe NominalDiffTime
age ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockAcquired", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"age" Key -> Maybe NominalDiffTime -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe NominalDiffTime
age]
TraceLeiosFetchClientBlockTxsAcquired LeiosPoint
point Maybe NominalDiffTime
age ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockTxsAcquired", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"age" Key -> Maybe NominalDiffTime -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe NominalDiffTime
age]
where
arrivalFields :: FetchArrivalBytes -> a
arrivalFields (MkFetchArrivalBytes Word32
invalid Word32
evicted Word32
good Word32
extra) =
[a] -> a
forall a. Monoid a => [a] -> a
mconcat
[Key
"invalidBytes" Key -> Word32 -> a
forall v. ToJSON v => Key -> v -> a
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word32
invalid, Key
"evictedBytes" Key -> Word32 -> a
forall v. ToJSON v => Key -> v -> a
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word32
evicted, Key
"goodBytes" Key -> Word32 -> a
forall v. ToJSON v => Key -> v -> a
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word32
good, Key
"extraBytes" Key -> Word32 -> a
forall v. ToJSON v => Key -> v -> a
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word32
extra]
forHuman :: TraceLeiosFetchClientEvent peer -> Text
forHuman = \case
TraceLeiosFetchClientBlockArrived peer
peer LeiosPoint
point FetchArrivalBytes
_ ->
Text
"Endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" arrived from " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> peer -> Text
forall a. Show a => a -> Text
showT peer
peer
TraceLeiosFetchClientTxsArrived peer
peer LeiosPoint
point FetchArrivalBytes
_ ->
Text
"Transactions of endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" arrived from " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> peer -> Text
forall a. Show a => a -> Text
showT peer
peer
TraceLeiosFetchClientBlockAcquired LeiosPoint
point Maybe NominalDiffTime
_ -> Text
"Acquired endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
TraceLeiosFetchClientBlockTxsAcquired LeiosPoint
point Maybe NominalDiffTime
_ ->
Text
"Acquired the transactions of endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
where
pretty :: LeiosPoint -> Text
pretty = String -> Text
Text.pack (String -> Text) -> (LeiosPoint -> String) -> LeiosPoint -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeiosPoint -> String
prettyLeiosPoint
instance MetaTrace (TraceLeiosFetchClientEvent peer) where
namespaceFor :: TraceLeiosFetchClientEvent peer
-> Namespace (TraceLeiosFetchClientEvent peer)
namespaceFor = \case
TraceLeiosFetchClientBlockArrived{} -> [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockArrived"]
TraceLeiosFetchClientTxsArrived{} -> [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsArrived"]
TraceLeiosFetchClientBlockAcquired{} -> [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockAcquired"]
TraceLeiosFetchClientBlockTxsAcquired{} -> [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockTxsAcquired"]
severityFor :: Namespace (TraceLeiosFetchClientEvent peer)
-> Maybe (TraceLeiosFetchClientEvent peer) -> Maybe SeverityS
severityFor (Namespace [Text]
_ [Text
"BlockArrived"]) Maybe (TraceLeiosFetchClientEvent peer)
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
severityFor (Namespace [Text]
_ [Text
"TxsArrived"]) Maybe (TraceLeiosFetchClientEvent peer)
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
severityFor (Namespace [Text]
_ [Text
"BlockAcquired"]) Maybe (TraceLeiosFetchClientEvent peer)
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Info
severityFor (Namespace [Text]
_ [Text
"BlockTxsAcquired"]) Maybe (TraceLeiosFetchClientEvent peer)
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Info
severityFor Namespace (TraceLeiosFetchClientEvent peer)
_ Maybe (TraceLeiosFetchClientEvent peer)
_ = Maybe SeverityS
forall a. Maybe a
Nothing
documentFor :: Namespace (TraceLeiosFetchClientEvent peer) -> Maybe Text
documentFor (Namespace [Text]
_ [Text
"BlockArrived"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"An endorser block arrived. Its bytes are invalid if it failed its checks, evicted if its point was pruned before its write settled, extra if another reply's write for the point settled first, and good otherwise. One the node writes is traced once its write settles."
documentFor (Namespace [Text]
_ [Text
"TxsArrived"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"Some of an endorser block's transactions arrived. The whole reply is invalid if it failed its checks. Otherwise each transaction's bytes are evicted if its point was pruned or the LeiosTxCache no longer retains the point, extra if its job was already done or the LeiosTxCache already held it, and good otherwise. A reply is traced once its write, if any, lands."
documentFor (Namespace [Text]
_ [Text
"BlockAcquired"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"The node acquired an endorser block it fetched; its age is how long after its point's slot began."
documentFor (Namespace [Text]
_ [Text
"BlockTxsAcquired"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"The node acquired all the transactions of an endorser block it fetched; its age is how long after its point's slot began."
documentFor Namespace (TraceLeiosFetchClientEvent peer)
_ = Maybe Text
forall a. Maybe a
Nothing
allNamespaces :: [Namespace (TraceLeiosFetchClientEvent peer)]
allNamespaces =
[ [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockArrived"]
, [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsArrived"]
, [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockAcquired"]
, [Text] -> [Text] -> Namespace (TraceLeiosFetchClientEvent peer)
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockTxsAcquired"]
]
pointFields :: LeiosPoint -> Aeson.Object
pointFields :: LeiosPoint -> KeyMap Value
pointFields (MkLeiosPoint (SlotNo Word64
slot) EndorserBlockHash
ebHash) =
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"slot" Key -> Word64 -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Word64
slot, Key
"ebHash" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
Text.pack (EndorserBlockHash -> String
forall h a. Hash h a -> String
hashToStringAsHex EndorserBlockHash
ebHash))]
instance LogFormatting TraceLeiosFetchServerEvent where
forMachine :: DetailLevel -> TraceLeiosFetchServerEvent -> KeyMap Value
forMachine DetailLevel
_dtal = \case
TraceLeiosFetchServerBlockRequested LeiosPoint
point ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockRequested", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point]
TraceLeiosFetchServerBlockServed LeiosPoint
point Int
bytes ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockServed", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"bytes" Key -> Int -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
bytes]
TraceLeiosFetchServerTxsRequested LeiosPoint
point Int
txCount ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"TxsRequested", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"txCount" Key -> Int -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
txCount]
TraceLeiosFetchServerTxsServed LeiosPoint
point Int
txCount Int
bytes ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat
[Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"TxsServed", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"txCount" Key -> Int -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
txCount, Key
"bytes" Key -> Int -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
bytes]
TraceLeiosFetchServerInvalidRequest ExnLeiosInvalidRequest
exn -> case ExnLeiosInvalidRequest
exn of
ExnLeiosUnknownBlockRequested LeiosPoint
point ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UnknownBlock", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point]
ExnLeiosUnknownTxsRequested LeiosPoint
point [Int]
offsets ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"UnknownTxs", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"offsets" Key -> [Int] -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Int]
offsets]
TraceLeiosFetchServerBlockDbFailure LeiosPoint
point LeiosDbException
err ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"BlockDbFailure", LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point, Key
"exception" Key -> LeiosDbException -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= LeiosDbException
err]
TraceLeiosFetchServerTxsDbFailure LeiosPoint
point [(Word16, Word64)]
bitmaps LeiosDbException
err ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat
[ Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"TxsDbFailure"
, LeiosPoint -> KeyMap Value
pointFields LeiosPoint
point
, Key
"bitmaps" Key -> [(Word16, Word64)] -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [(Word16, Word64)]
bitmaps
, Key
"exception" Key -> LeiosDbException -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= LeiosDbException
err
]
TraceLeiosFetchServerOpenReaderDbFailure LeiosDbException
err ->
[KeyMap Value] -> KeyMap Value
forall a. Monoid a => [a] -> a
mconcat [Key
"kind" Key -> Value -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"OpenReaderDbFailure", Key
"exception" Key -> LeiosDbException -> KeyMap Value
forall v. ToJSON v => Key -> v -> KeyMap Value
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= LeiosDbException
err]
forHuman :: TraceLeiosFetchServerEvent -> Text
forHuman = \case
TraceLeiosFetchServerBlockRequested LeiosPoint
point ->
Text
"Requested endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
TraceLeiosFetchServerBlockServed LeiosPoint
point Int
bytes ->
Text
"Served endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
showT Int
bytes Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" bytes"
TraceLeiosFetchServerTxsRequested LeiosPoint
point Int
txCount ->
Text
"Requested " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
showT Int
txCount Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" transactions of endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
TraceLeiosFetchServerTxsServed LeiosPoint
point Int
txCount Int
bytes ->
Text
"Served "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
showT Int
txCount
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" transactions of endorser block "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
showT Int
bytes
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" bytes"
TraceLeiosFetchServerInvalidRequest ExnLeiosInvalidRequest
exn -> case ExnLeiosInvalidRequest
exn of
ExnLeiosUnknownBlockRequested LeiosPoint
point ->
Text
"Disconnecting a client that requested endorser block " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", which is not held"
ExnLeiosUnknownTxsRequested LeiosPoint
point [Int]
offsets ->
Text
"Disconnecting a client that requested transactions of endorser block "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" at offsets "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Int] -> Text
forall a. Show a => a -> Text
showT [Int]
offsets
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", which are not held"
TraceLeiosFetchServerBlockDbFailure LeiosPoint
point LeiosDbException
err ->
Text
"Disconnecting a client, since reading its requested endorser block "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" from the LeiosDB failed: "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (LeiosDbException -> String
forall e. Exception e => e -> String
displayException LeiosDbException
err)
TraceLeiosFetchServerTxsDbFailure LeiosPoint
point [(Word16, Word64)]
_bitmaps LeiosDbException
err ->
Text
"Disconnecting a client, since reading its requested transactions of endorser block "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LeiosPoint -> Text
pretty LeiosPoint
point
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" from the LeiosDB failed: "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (LeiosDbException -> String
forall e. Exception e => e -> String
displayException LeiosDbException
err)
TraceLeiosFetchServerOpenReaderDbFailure LeiosDbException
err ->
Text
"Disconnecting a client, since opening its LeiosDB reader failed: "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (LeiosDbException -> String
forall e. Exception e => e -> String
displayException LeiosDbException
err)
where
pretty :: LeiosPoint -> Text
pretty = String -> Text
Text.pack (String -> Text) -> (LeiosPoint -> String) -> LeiosPoint -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LeiosPoint -> String
prettyLeiosPoint
instance MetaTrace TraceLeiosFetchServerEvent where
namespaceFor :: TraceLeiosFetchServerEvent -> Namespace TraceLeiosFetchServerEvent
namespaceFor = \case
TraceLeiosFetchServerBlockRequested{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockRequested"]
TraceLeiosFetchServerBlockServed{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockServed"]
TraceLeiosFetchServerTxsRequested{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsRequested"]
TraceLeiosFetchServerTxsServed{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsServed"]
TraceLeiosFetchServerInvalidRequest ExnLeiosUnknownBlockRequested{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"UnknownBlock"]
TraceLeiosFetchServerInvalidRequest ExnLeiosUnknownTxsRequested{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"UnknownTxs"]
TraceLeiosFetchServerBlockDbFailure{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockDbFailure"]
TraceLeiosFetchServerTxsDbFailure{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsDbFailure"]
TraceLeiosFetchServerOpenReaderDbFailure{} -> [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"OpenReaderDbFailure"]
severityFor :: Namespace TraceLeiosFetchServerEvent
-> Maybe TraceLeiosFetchServerEvent -> Maybe SeverityS
severityFor (Namespace [Text]
_ [Text
"BlockRequested"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
severityFor (Namespace [Text]
_ [Text
"BlockServed"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Info
severityFor (Namespace [Text]
_ [Text
"TxsRequested"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Debug
severityFor (Namespace [Text]
_ [Text
"TxsServed"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Info
severityFor (Namespace [Text]
_ [Text
"UnknownBlock"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
severityFor (Namespace [Text]
_ [Text
"UnknownTxs"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Notice
severityFor (Namespace [Text]
_ [Text
"BlockDbFailure"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Error
severityFor (Namespace [Text]
_ [Text
"TxsDbFailure"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Error
severityFor (Namespace [Text]
_ [Text
"OpenReaderDbFailure"]) Maybe TraceLeiosFetchServerEvent
_ = SeverityS -> Maybe SeverityS
forall a. a -> Maybe a
Just SeverityS
Error
severityFor Namespace TraceLeiosFetchServerEvent
_ Maybe TraceLeiosFetchServerEvent
_ = Maybe SeverityS
forall a. Maybe a
Nothing
documentFor :: Namespace TraceLeiosFetchServerEvent -> Maybe Text
documentFor (Namespace [Text]
_ [Text
"BlockRequested"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"A client requested an endorser block."
documentFor (Namespace [Text]
_ [Text
"BlockServed"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"The server sent a client an endorser block."
documentFor (Namespace [Text]
_ [Text
"TxsRequested"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"A client requested some of an endorser block's transactions."
documentFor (Namespace [Text]
_ [Text
"TxsServed"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"The server sent a client some of an endorser block's transactions."
documentFor (Namespace [Text]
_ [Text
"UnknownBlock"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"A client requested an endorser block that the node does not hold, so the server disconnects it."
documentFor (Namespace [Text]
_ [Text
"UnknownTxs"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"A client requested transactions that the node does not hold, so the server disconnects it."
documentFor (Namespace [Text]
_ [Text
"BlockDbFailure"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"Reading a client's requested endorser block from the LeiosDB failed, so the server disconnects the client."
documentFor (Namespace [Text]
_ [Text
"TxsDbFailure"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just
Text
"Reading a client's requested transactions from the LeiosDB failed, so the server disconnects the client."
documentFor (Namespace [Text]
_ [Text
"OpenReaderDbFailure"]) =
Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"Opening the server's LeiosDB reader failed, so the server disconnects the client."
documentFor Namespace TraceLeiosFetchServerEvent
_ = Maybe Text
forall a. Maybe a
Nothing
allNamespaces :: [Namespace TraceLeiosFetchServerEvent]
allNamespaces =
[ [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockRequested"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockServed"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsRequested"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsServed"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"UnknownBlock"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"UnknownTxs"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"BlockDbFailure"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"TxsDbFailure"]
, [Text] -> [Text] -> Namespace TraceLeiosFetchServerEvent
forall a. [Text] -> [Text] -> Namespace a
Namespace [] [Text
"OpenReaderDbFailure"]
]