Skip to content

Commit 76f4c77

Browse files
committed
phase 3
1 parent 36a62ac commit 76f4c77

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

  • cardano-node/src/Cardano/Node/Tracing/Tracers

cardano-node/src/Cardano/Node/Tracing/Tracers/Rpc.hs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Cardano.Api.Pretty
1313

1414
import Cardano.Logging hiding (nsInner)
1515
import Cardano.Rpc.Server (TraceRpc (..), TraceRpcQuery (..), TraceRpcSubmit (..),
16-
TraceSpanEvent (..))
16+
TraceRpcSync (..), TraceSpanEvent (..))
1717

1818
import Data.Aeson (Object, Value (..), (.=))
1919

@@ -48,6 +48,13 @@ instance LogFormatting TraceRpc where
4848
TraceRpcSubmitSpan s -> [spanToObject s]
4949
TraceRpcEvalTxDecodingError _ -> []
5050
TraceRpcEvalTxSpan s -> [spanToObject s]
51+
TraceRpcSync syncTrace ->
52+
["kind" .= String "SyncService"]
53+
<> case syncTrace of
54+
TraceRpcFetchBlockSpan s -> [spanToObject s]
55+
TraceRpcFetchBlockNotFound _ -> []
56+
TraceRpcNodeKernelAccessUnavailable -> []
57+
TraceRpcForkerError _ -> []
5158

5259
forHuman = docToText . pretty
5360

@@ -59,6 +66,7 @@ instance LogFormatting TraceRpc where
5966
TraceRpcQuery (TraceRpcQuerySearchUtxosSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.SearchUtxos" Nothing]
6067
TraceRpcSubmit (TraceRpcSubmitSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.SubmitTx" Nothing]
6168
TraceRpcSubmit (TraceRpcEvalTxSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.EvalTx" Nothing]
69+
TraceRpcSync (TraceRpcFetchBlockSpan (SpanBegin _)) -> [CounterM "rpc.request.SyncService.FetchBlock" Nothing]
6270
_ -> []
6371

6472
instance MetaTrace TraceRpc where
@@ -81,6 +89,13 @@ instance MetaTrace TraceRpc where
8189
TraceRpcSubmitSpan _ -> ["SubmitTx", "Span"]
8290
TraceRpcEvalTxDecodingError _ -> ["EvalTxDecodingError"]
8391
TraceRpcEvalTxSpan _ -> ["EvalTx", "Span"]
92+
TraceRpcSync syncTrace ->
93+
"SyncService"
94+
: case syncTrace of
95+
TraceRpcFetchBlockSpan _ -> ["FetchBlock", "Span"]
96+
TraceRpcFetchBlockNotFound _ -> ["FetchBlockNotFound"]
97+
TraceRpcNodeKernelAccessUnavailable -> ["NodeKernelAccessUnavailable"]
98+
TraceRpcForkerError _ -> ["ForkerError"]
8499

85100
severityFor (Namespace _ nsInner) _ = case nsInner of
86101
["FatalError"] -> Just Error -- RPC server startup errors
@@ -94,6 +109,10 @@ instance MetaTrace TraceRpc where
94109
["SubmitService", "TxDecodingError"] -> Just Debug -- request error
95110
["SubmitService", "TxValidationError"] -> Just Debug -- request error
96111
["SubmitService", "EvalTxDecodingError"] -> Just Debug -- request error
112+
["SyncService", "FetchBlock", "Span"] -> Just Debug
113+
["SyncService", "FetchBlockNotFound"] -> Just Debug -- normal: block may have been pruned
114+
["SyncService", "NodeKernelAccessUnavailable"] -> Just Warning -- kernel not yet ready
115+
["SyncService", "ForkerError"] -> Just Warning -- unexpected ledger forker error
97116
_ -> Nothing
98117

99118
documentFor (Namespace _ nsInner) = case nsInner of
@@ -110,6 +129,10 @@ instance MetaTrace TraceRpc where
110129
["SubmitService", "TxDecodingError"] -> Just "A regular request error, when submitted transaction decoding fails."
111130
["SubmitService", "TxValidationError"] -> Just "A regular request error, when submitted transaction is invalid."
112131
["SubmitService", "EvalTxDecodingError"] -> Just "A regular request error, when evalTx transaction decoding fails."
132+
["SyncService", "FetchBlock", "Span"] -> Just "Span for the FetchBlock SyncService method."
133+
["SyncService", "FetchBlockNotFound"] -> Just "Requested block was not found in ChainDB."
134+
["SyncService", "NodeKernelAccessUnavailable"] -> Just "Node kernel access not yet initialised. The node is still starting up."
135+
["SyncService", "ForkerError"] -> Just "Unexpected error from ledger forker."
113136
_ -> Nothing
114137

115138
metricsDocFor (Namespace _ nsInner) = case nsInner of
@@ -123,6 +146,8 @@ instance MetaTrace TraceRpc where
123146
[("rpc.request.SubmitService.SubmitTx", "Span for the SubmitTx UTXORPC method.")]
124147
["SubmitService", "EvalTx", "Span"] ->
125148
[("rpc.request.SubmitService.EvalTx", "Span for the EvalTx UTXORPC method.")]
149+
["SyncService", "FetchBlock", "Span"] ->
150+
[("rpc.request.SyncService.FetchBlock", "Span for the FetchBlock SyncService method.")]
126151
_ -> []
127152

128153
allNamespaces =
@@ -138,6 +163,10 @@ instance MetaTrace TraceRpc where
138163
, ["SubmitService", "TxDecodingError"]
139164
, ["SubmitService", "TxValidationError"]
140165
, ["SubmitService", "EvalTxDecodingError"]
166+
, ["SyncService", "FetchBlock", "Span"]
167+
, ["SyncService", "FetchBlockNotFound"]
168+
, ["SyncService", "NodeKernelAccessUnavailable"]
169+
, ["SyncService", "ForkerError"]
141170
]
142171

143172
-- helper functions

0 commit comments

Comments
 (0)