Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,20 @@ allow-newer:
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

source-repository-package
type: git
location: https://github.com/intersectmbo/cardano-api.git
tag: 1ad558ffb8fd9f8b00bb81c42ae4428575dbca34
--sha256: 1x6lhnnyp5393myx08yfyriwnpz0f9y0g303nbq9hzh92yzyhi6b
subdir:
cardano-api
cardano-rpc

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-cli.git
tag: 66edca364e7c128f95faf6717f6d0391f7518301
--sha256: 13in641rswzs7qiac6fj6abv8xd2yvrcm58lav5553wz8s9sxfxm
subdir:
cardano-cli

24 changes: 24 additions & 0 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/Rpc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ instance LogFormatting TraceRpc where
[ "queryName" .= String "ReadUtxos"
, spanToObject s
]
TraceRpcQuerySearchUtxosSpan s ->
[ "queryName" .= String "SearchUtxos"
, spanToObject s
]
TraceRpcSubmit submitTrace ->
["kind" .= String "SubmitService"]
<> case submitTrace of
TraceRpcSubmitN2cConnectionError _ -> []
TraceRpcSubmitTxDecodingError _ -> []
TraceRpcSubmitTxValidationError _ -> []
TraceRpcSubmitSpan s -> [spanToObject s]
TraceRpcEvalTxDecodingError _ -> []
TraceRpcEvalTxSpan s -> [spanToObject s]

forHuman = docToText . pretty

Expand All @@ -50,7 +56,9 @@ instance LogFormatting TraceRpc where
-- query names here are taken from UTXORPC spec: https://utxorpc.org/query/intro/#operations
TraceRpcQuery (TraceRpcQueryParamsSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.ReadParams" Nothing]
TraceRpcQuery (TraceRpcQueryReadUtxosSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.ReadUtxos" Nothing]
TraceRpcQuery (TraceRpcQuerySearchUtxosSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.SearchUtxos" Nothing]
TraceRpcSubmit (TraceRpcSubmitSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.SubmitTx" Nothing]
TraceRpcSubmit (TraceRpcEvalTxSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.EvalTx" Nothing]
_ -> []

instance MetaTrace TraceRpc where
Expand All @@ -63,45 +71,58 @@ instance MetaTrace TraceRpc where
: case queryTrace of
TraceRpcQueryParamsSpan _ -> ["ReadParams", "Span"]
TraceRpcQueryReadUtxosSpan _ -> ["ReadUtxos", "Span"]
TraceRpcQuerySearchUtxosSpan _ -> ["SearchUtxos", "Span"]
TraceRpcSubmit submitTrace ->
"SubmitService"
: case submitTrace of
TraceRpcSubmitN2cConnectionError _ -> ["N2cConnectionError"]
TraceRpcSubmitTxDecodingError _ -> ["TxDecodingError"]
TraceRpcSubmitTxValidationError _ -> ["TxValidationError"]
TraceRpcSubmitSpan _ -> ["SubmitTx", "Span"]
TraceRpcEvalTxDecodingError _ -> ["EvalTxDecodingError"]
TraceRpcEvalTxSpan _ -> ["EvalTx", "Span"]

severityFor (Namespace _ nsInner) _ = case nsInner of
["FatalError"] -> Just Error -- RPC server startup errors
["Error"] -> Just Debug -- those are normal operation errors, like request errors, hide them by default
["QueryService", "ReadParams", "Span"] -> Just Debug
["QueryService", "ReadUtxos", "Span"] -> Just Debug
["QueryService", "SearchUtxos", "Span"] -> Just Debug
["SubmitService", "SubmitTx", "Span"] -> Just Debug
["SubmitService", "EvalTx", "Span"] -> Just Debug
["SubmitService", "N2cConnectionError"] -> Just Warning -- this is a more serious error, this shouldn't happen
["SubmitService", "TxDecodingError"] -> Just Debug -- request error
["SubmitService", "TxValidationError"] -> Just Debug -- request error
["SubmitService", "EvalTxDecodingError"] -> Just Debug -- request error
_ -> Nothing

documentFor (Namespace _ nsInner) = case nsInner of
["FatalError"] -> Just "RPC startup critical error."
["Error"] -> Just "Normal operation errors such as request errors. Those are not harmful to the RPC server itself."
["QueryService", "ReadParams", "Span"] -> Just "Span for the ReadParams UTXORPC method."
["QueryService", "ReadUtxos", "Span"] -> Just "Span for the ReadUtxos UTXORPC method."
["QueryService", "SearchUtxos", "Span"] -> Just "Span for the SearchUtxos UTXORPC method."
["SubmitService", "SubmitTx", "Span"] -> Just "Span for the SubmitTx UTXORPC method."
["SubmitService", "EvalTx", "Span"] -> Just "Span for the EvalTx UTXORPC method."
["SubmitService", "N2cConnectionError"] ->
Just
"Node connection error. This should not happen, as this means that there is an issue in cardano-rpc configuration."
["SubmitService", "TxDecodingError"] -> Just "A regular request error, when submitted transaction decoding fails."
["SubmitService", "TxValidationError"] -> Just "A regular request error, when submitted transaction is invalid."
["SubmitService", "EvalTxDecodingError"] -> Just "A regular request error, when evalTx transaction decoding fails."
_ -> Nothing

metricsDocFor (Namespace _ nsInner) = case nsInner of
["QueryService", "ReadParams", "Span"] ->
[("rpc.request.QueryService.ReadParams", "Span for the ReadParams UTXORPC method.")]
["QueryService", "ReadUtxos", "Span"] ->
[("rpc.request.QueryService.ReadUtxos", "Span for the ReadUtxos UTXORPC method.")]
["QueryService", "SearchUtxos", "Span"] ->
[("rpc.request.QueryService.SearchUtxos", "Span for the SearchUtxos UTXORPC method.")]
["SubmitService", "SubmitTx", "Span"] ->
[("rpc.request.SubmitService.SubmitTx", "Span for the SubmitTx UTXORPC method.")]
["SubmitService", "EvalTx", "Span"] ->
[("rpc.request.SubmitService.EvalTx", "Span for the EvalTx UTXORPC method.")]
_ -> []

allNamespaces =
Expand All @@ -110,10 +131,13 @@ instance MetaTrace TraceRpc where
, ["Error"]
, ["QueryService", "ReadParams", "Span"]
, ["QueryService", "ReadUtxos", "Span"]
, ["QueryService", "SearchUtxos", "Span"]
, ["SubmitService", "SubmitTx", "Span"]
, ["SubmitService", "EvalTx", "Span"]
, ["SubmitService", "N2cConnectionError"]
, ["SubmitService", "TxDecodingError"]
, ["SubmitService", "TxValidationError"]
, ["SubmitService", "EvalTxDecodingError"]
]

-- helper functions
Expand Down
1 change: 1 addition & 0 deletions cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ test-suite cardano-testnet-test
Cardano.Testnet.Test.Gov.TreasuryDonation
Cardano.Testnet.Test.Gov.TreasuryGrowth
Cardano.Testnet.Test.Gov.TreasuryWithdrawal
Cardano.Testnet.Test.Rpc.Eval
Cardano.Testnet.Test.Rpc.Query
Cardano.Testnet.Test.Rpc.Transaction
Cardano.Testnet.Test.Misc
Expand Down
Loading
Loading