diff --git a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs index cc05b119e80..2c1a04a3dc6 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs @@ -39,7 +39,6 @@ import Cardano.Node.Tracing.Era.Shelley () import Cardano.Node.Tracing.Formatting () import Cardano.Node.Tracing.Tracers.ChainDB () import Cardano.Node.Types -import Cardano.Protocol.Crypto (StandardCrypto) import qualified Ouroboros.Consensus.Cardano as Consensus import Ouroboros.Consensus.HardFork.Combinator.AcrossEras () import Ouroboros.Consensus.Protocol.Praos.Common (PraosCanBeLeader (..), diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs index 838d91373f8..616cc8f667d 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs @@ -92,6 +92,7 @@ import LeiosDemoTypes (AnnouncementFields (..), FetchArrivalBytes (..) TraceLeiosKernel (..), TraceLeiosPeer (..), traceLeiosKernelToObject, traceLeiosPeerToObject) import qualified LeiosDemoTypes as Leios +import LeiosDemoDb.Trace (TraceLeiosDb (..), LeiosDbStats (..)) import LeiosUtils.CallTrace (SomeJsonCallTrace (..), callTraceToObject) enclosingValue :: ToJSON a => Enclosing' a -> Value @@ -2513,6 +2514,12 @@ instance LogFormatting TraceLeiosKernel where , CounterM "leiosFetchTxsGoodBytes" (Just (fromIntegral (fabGood fab))) , CounterM "leiosFetchTxsExtraBytes" (Just (fromIntegral (fabExtra fab))) ] + -- Sampled on a timer, so these exist from node start. + TraceLeiosDb (TraceLeiosDbStats (LeiosDbStats { volatileEbs, immutableEbs, walBytes })) -> + [ IntM "leiosDbVolatileEbs" (fromIntegral volatileEbs) + , IntM "leiosDbImmutableEbs" (fromIntegral immutableEbs) + , IntM "leiosDbWalBytes" walBytes + ] _ -> [] instance MetaTrace TraceLeiosKernel where @@ -2534,6 +2541,10 @@ instance MetaTrace TraceLeiosKernel where namespaceFor TraceLeiosVoteScheduled{} = Namespace [] ["VoteScheduled"] namespaceFor TraceLeiosEbValidated{} = Namespace [] ["EbValidated"] namespaceFor TraceLeiosDbException{} = Namespace [] ["DbException"] + -- Call spans get their own namespace under Db so their severity and + -- frequency can be configured apart from the stats gauges (a dozen span + -- events per GC vs one stats event). + namespaceFor (TraceLeiosDb TraceLeiosDbCall{}) = Namespace [] ["Db", "Call"] namespaceFor TraceLeiosDb{} = Namespace [] ["Db"] namespaceFor TraceLeiosCertifiedAndAnnounced{} = Namespace [] ["CertifiedAndAnnounced"] namespaceFor TraceLeiosAnnouncementPastHorizon{} = Namespace [] ["AnnouncementPastHorizon"] @@ -2546,6 +2557,7 @@ instance MetaTrace TraceLeiosKernel where -- under the default Notice threshold while its metric still flows to EKG. severityFor (Namespace _ ["FetchBodyArrival"]) _ = Just Debug severityFor (Namespace _ ["FetchTxsArrival"]) _ = Just Debug + severityFor (Namespace _ ["Db", "Call"]) _ = Just Debug severityFor _ _ = Just Info documentFor _ = Nothing @@ -2562,6 +2574,22 @@ instance MetaTrace TraceLeiosKernel where , ("leiosFetchTxsGoodBytes", "Tx bytes a cached body expected and had not yet held (the expected case).") , ("leiosFetchTxsExtraBytes", "Tx bytes already held (redundant).") ] + metricsDocFor (Namespace _ ["Db"]) = + [ ("leiosDbVolatileEbs", "LeiosDb: announced EB rows in the volatile partition") + , ("leiosDbVolatileEbTxs", "LeiosDb: EB body rows in the volatile partition") + , ("leiosDbVolatileTxs", "LeiosDb: transactions in the volatile partition") + , ("leiosDbImmutableEbs", "LeiosDb: announced EB rows in the immutable partition") + , ("leiosDbImmutableEbTxs", "LeiosDb: EB body rows in the immutable partition") + , ("leiosDbImmutableTxs", "LeiosDb: transactions in the immutable partition") + , ("leiosDbFileBytes", "LeiosDb: size of the main database file in bytes") + , ("leiosDbWalBytes", "LeiosDb: current size of the write-ahead log in bytes") + , ("leiosDbCopiedEbs", "LeiosDb: announcement rows copied into the immutable partition") + , ("leiosDbCopiedEbTxs", "LeiosDb: EB body rows copied into the immutable partition") + , ("leiosDbCopiedTxs", "LeiosDb: transactions copied into the immutable partition") + , ("leiosDbEvictedEbs", "LeiosDb: announcement rows garbage collected from the volatile partition") + , ("leiosDbEvictedEbTxs", "LeiosDb: EB body rows garbage collected from the volatile partition") + , ("leiosDbEvictedTxs", "LeiosDb: transactions garbage collected from the volatile partition") + ] metricsDocFor _ = [] allNamespaces = @@ -2585,6 +2613,7 @@ instance MetaTrace TraceLeiosKernel where , Namespace [] ["TxCacheEbBody"] , Namespace [] ["DbException"] , Namespace [] ["Db"] + , Namespace [] ["Db", "Call"] , Namespace [] ["CertifiedAndAnnounced"] , Namespace [] ["AnnouncementPastHorizon"] , Namespace [] ["AnnouncementAccepted"] @@ -2615,4 +2644,3 @@ instance MetaTrace TraceLeiosPeer where , Namespace [] ["DbException"] , Namespace [] ["Announcement"] ] -