From 0d98405a60d57e1c8e13406d51cce0e34356bd64 Mon Sep 17 00:00:00 2001 From: Armando Santos Date: Tue, 5 Mar 2024 15:31:36 +0000 Subject: [PATCH 01/10] Bump CHaP and hackageNix --- cabal.project | 4 ++-- flake.lock | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cabal.project b/cabal.project index fbdb1810247..abf1dc0f689 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2024-02-27T08:06:51Z - , cardano-haskell-packages 2024-02-26T17:55:44Z + , hackage.haskell.org 2024-03-06T13:35:48Z + , cardano-haskell-packages 2024-03-06T12:32:14Z packages: cardano-git-rev diff --git a/flake.lock b/flake.lock index bd63cb4a4d6..45a12b2767b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1708970955, - "narHash": "sha256-k6Y9WjDej7wCkUowVi/tdsWP6EWUMZTSRU9r+4lMJmU=", + "lastModified": 1709731402, + "narHash": "sha256-7h4/ns3WRI3BtK1FbUEm6nMqW1ahNNehiHr7eQ03muk=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "f09964311e8894a5f09e258f308a9c3d4221f029", + "rev": "8e4f211a8e537c8c939b65e887556bd7441c774c", "type": "github" }, "original": { @@ -624,11 +624,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1708993343, - "narHash": "sha256-8EbbR5ReQK61yP/7VYtFSCerBXSE59VtfV+Wahdsuqg=", + "lastModified": 1709684582, + "narHash": "sha256-+rC8Vpaxdd4Nw2fJIn9wzAnzW5arILly5AkTG6chRAw=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "f823c9258e9316cb4da256fc93e9c0407f0c296a", + "rev": "c2ed9aa79252ed67a1fb694b3fffaf7dd7ead6d2", "type": "github" }, "original": { From ae923e18b1e98032e7531897c44bf0155f0209a5 Mon Sep 17 00:00:00 2001 From: Armando Santos Date: Mon, 18 Mar 2024 14:46:17 +0000 Subject: [PATCH 02/10] Release 8.9.1 --- bench/locli/locli.cabal | 2 +- bench/plutus-scripts-bench/plutus-scripts-bench.cabal | 2 +- bench/tx-generator/tx-generator.cabal | 2 +- cabal.project | 4 ++-- cardano-node/cardano-node.cabal | 10 +++++----- cardano-node/src/Cardano/Node/Tracing/StateRep.hs | 6 ------ cardano-submit-api/cardano-submit-api.cabal | 4 ++-- cardano-testnet/cardano-testnet.cabal | 4 ++-- cardano-tracer/cardano-tracer.cabal | 4 ++-- flake.lock | 6 +++--- trace-dispatcher/trace-dispatcher.cabal | 4 ++-- 11 files changed, 21 insertions(+), 27 deletions(-) diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index 1eb98f55af9..c7418a99fb0 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -121,7 +121,7 @@ library , optparse-generic , ouroboros-consensus -- for Data.SOP.Strict: - , ouroboros-network ^>= 0.12 + , ouroboros-network ^>= 0.13 , ouroboros-network-api , process , quiet diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index b0dac39a86c..8a43f18258d 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -73,7 +73,7 @@ library -- IOG dependencies -------------------------- build-depends: - , cardano-api ^>= 8.39.2.0 + , cardano-api ^>= 8.39.3.0 , plutus-ledger-api >=1.0.0 , plutus-tx >=1.0.0 , plutus-tx-plugin ^>=1.21 diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index b3eee7f8bff..29bf628c290 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -100,7 +100,7 @@ library , attoparsec-aeson , base16-bytestring , bytestring - , cardano-api ^>= 8.39.2.0 + , cardano-api ^>= 8.39.3.0 , cardano-binary , cardano-cli ^>= 8.20.3.0 , cardano-crypto-class diff --git a/cabal.project b/cabal.project index abf1dc0f689..df7fb2d8628 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2024-03-06T13:35:48Z - , cardano-haskell-packages 2024-03-06T12:32:14Z + , hackage.haskell.org 2024-03-20T14:55:30Z + , cardano-haskell-packages 2024-03-20T14:22:58Z packages: cardano-git-rev diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 7d425f8cd85..cf2496f9ad5 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -144,7 +144,7 @@ library , async , base16-bytestring , bytestring - , cardano-api ^>= 8.39.2.0 + , cardano-api ^>= 8.39.3.0 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev @@ -185,11 +185,11 @@ library , optparse-applicative-fork >= 0.18.1 , ouroboros-consensus ^>= 0.16 , ouroboros-consensus-cardano ^>= 0.14 - , ouroboros-consensus-diffusion ^>= 0.11 + , ouroboros-consensus-diffusion ^>= 0.12 , ouroboros-consensus-protocol - , ouroboros-network-api - , ouroboros-network ^>= 0.12 - , ouroboros-network-framework + , ouroboros-network-api ^>= 0.7 + , ouroboros-network ^>= 0.13 + , ouroboros-network-framework ^>= 0.12 , ouroboros-network-protocols ^>= 0.8 , prettyprinter , prettyprinter-ansi-terminal diff --git a/cardano-node/src/Cardano/Node/Tracing/StateRep.hs b/cardano-node/src/Cardano/Node/Tracing/StateRep.hs index 8dc1ecb7667..b34e63ec717 100644 --- a/cardano-node/src/Cardano/Node/Tracing/StateRep.hs +++ b/cardano-node/src/Cardano/Node/Tracing/StateRep.hs @@ -47,12 +47,6 @@ deriving instance ToJSON ChunkNo deriving instance NFData ChunkNo -deriving instance Generic NPV.NodeToNodeVersion -deriving instance NFData NPV.NodeToNodeVersion - -deriving instance Generic NPV.NodeToClientVersion -deriving instance NFData NPV.NodeToClientVersion - data OpeningDbs = StartedOpeningImmutableDB | OpenedImmutableDB (WithOrigin SlotNo) ChunkNo diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index dfbc7cbd560..e587c260290 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -39,7 +39,7 @@ library , aeson , async , bytestring - , cardano-api ^>= 8.39.2.0 + , cardano-api ^>= 8.39.3.0 , cardano-binary , cardano-cli ^>= 8.20.3.0 , cardano-crypto-class ^>= 2.1.2 @@ -49,7 +49,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus-cardano - , ouroboros-network ^>= 0.12 + , ouroboros-network ^>= 0.13 , ouroboros-network-protocols , prometheus >= 2.2.4 , servant diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index 0f3d20e0f61..3dfabfd85ec 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -34,7 +34,7 @@ library build-depends: aeson , ansi-terminal , bytestring - , cardano-api ^>= 8.39.2.0 + , cardano-api ^>= 8.39.3.0 , cardano-cli ^>= 8.20.3.0 , cardano-crypto-class , cardano-crypto-wrapper @@ -63,7 +63,7 @@ library , network , network-mux , optparse-applicative-fork - , ouroboros-network ^>= 0.12 + , ouroboros-network ^>= 0.13 , ouroboros-network-api , prettyprinter , process diff --git a/cardano-tracer/cardano-tracer.cabal b/cardano-tracer/cardano-tracer.cabal index 3c5958eaca2..e2904cff589 100644 --- a/cardano-tracer/cardano-tracer.cabal +++ b/cardano-tracer/cardano-tracer.cabal @@ -147,12 +147,12 @@ library , directory , ekg , ekg-core - , ekg-forward ^>= 0.4 + , ekg-forward ^>= 0.5 , extra , filepath , mime-mail , optparse-applicative - , ouroboros-network ^>= 0.12 + , ouroboros-network ^>= 0.13 , ouroboros-network-api , ouroboros-network-framework , signal diff --git a/flake.lock b/flake.lock index 45a12b2767b..9b0014d755c 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1709731402, - "narHash": "sha256-7h4/ns3WRI3BtK1FbUEm6nMqW1ahNNehiHr7eQ03muk=", + "lastModified": 1710945682, + "narHash": "sha256-xp1txUjrtCuKHAy0nvz/lu0MlNdNnzvP8l2p9MFB73Y=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "8e4f211a8e537c8c939b65e887556bd7441c774c", + "rev": "8df2bf06e4525ec39c106cd2593e3c5fd7f2b081", "type": "github" }, "original": { diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index b6cbc908018..bf3b07cf655 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -56,11 +56,11 @@ library , deepseq , ekg , ekg-core - , ekg-forward >= 0.4 + , ekg-forward >= 0.5 , hostname , network , optparse-applicative-fork - , ouroboros-network ^>= 0.12 + , ouroboros-network ^>= 0.13 , ouroboros-network-api , ouroboros-network-framework , serialise From da945ea983d4722a9ffe54250edba9a193a57cf0 Mon Sep 17 00:00:00 2001 From: Armando Santos Date: Wed, 20 Mar 2024 16:09:11 +0000 Subject: [PATCH 03/10] Bump cardano-node to 8.9.1 --- cardano-node/cardano-node.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index cf2496f9ad5..ae0a9a99030 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node -version: 8.9.0 +version: 8.9.1 synopsis: The cardano full node description: The cardano full node. category: Cardano, From 7f05fb801370c8526e3f0ab2645b1e0f60ad1150 Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Thu, 4 Apr 2024 17:56:16 +0200 Subject: [PATCH 04/10] Integrate with new ouroboros-network version --- .github/workflows/haskell.yml | 2 +- bench/locli/locli.cabal | 2 +- cabal.project | 2 +- cardano-node/cardano-node.cabal | 4 ++-- cardano-node/src/Cardano/Node/Run.hs | 6 ++++-- cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs | 4 +++- cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs | 6 ++++-- cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/cardano-testnet.cabal | 2 +- cardano-tracer/cardano-tracer.cabal | 2 +- flake.lock | 6 +++--- trace-dispatcher/trace-dispatcher.cabal | 2 +- 12 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 81581785612..3ff97a4a78e 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -38,7 +38,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2024-02-29" + CABAL_CACHE_VERSION: "2024-04-08" concurrency: group: > diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index c7418a99fb0..a0e3173d9b4 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -121,7 +121,7 @@ library , optparse-generic , ouroboros-consensus -- for Data.SOP.Strict: - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-api , process , quiet diff --git a/cabal.project b/cabal.project index df7fb2d8628..f8ec5f6849a 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-03-20T14:55:30Z - , cardano-haskell-packages 2024-03-20T14:22:58Z + , cardano-haskell-packages 2024-04-08T15:27:49Z packages: cardano-git-rev diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index ae0a9a99030..37645eb6e9a 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -185,10 +185,10 @@ library , optparse-applicative-fork >= 0.18.1 , ouroboros-consensus ^>= 0.16 , ouroboros-consensus-cardano ^>= 0.14 - , ouroboros-consensus-diffusion ^>= 0.12 + , ouroboros-consensus-diffusion ^>= 0.14 , ouroboros-consensus-protocol , ouroboros-network-api ^>= 0.7 - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-framework ^>= 0.12 , ouroboros-network-protocols ^>= 0.8 , prettyprinter diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index 1b474f7c14c..17e6dc3491b 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -374,8 +374,9 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do dbPath <- canonDbPath nc - let diffusionArguments :: Diffusion.Arguments Socket RemoteAddress - LocalSocket LocalAddress + publicPeerSelectionVar <- Diffusion.makePublicPeerSelectionStateVar + let diffusionArguments :: Diffusion.Arguments IO Socket RemoteAddress + LocalSocket LocalAddress diffusionArguments = Diffusion.Arguments { Diffusion.daIPv4Address = @@ -395,6 +396,7 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do Nothing -> Nothing , Diffusion.daAcceptedConnectionsLimit = ncAcceptedConnectionsLimit nc , Diffusion.daMode = ncDiffusionMode nc + , Diffusion.daPublicPeerSelectionVar = publicPeerSelectionVar } ipv4 <- traverse getSocketOrSocketInfoAddr publicIPv4SocketOrAddr diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 3642e1be4f8..424abcd716c 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -40,6 +40,7 @@ import qualified Ouroboros.Network.PeerSelection.State.KnownPeers as KnownPeers import Ouroboros.Network.PeerSelection.State.LocalRootPeers (HotValency (..), WarmValency (..)) import Ouroboros.Network.PeerSelection.Types () +import Ouroboros.Network.Protocol.PeerSharing.Type (PeerSharingAmount (..)) import Ouroboros.Network.RethrowPolicy (ErrorCommand (..)) import Ouroboros.Network.Server2 (ServerTrace (..)) import Ouroboros.Network.Snocket (LocalAddress (..)) @@ -272,10 +273,11 @@ instance LogFormatting (TracePeerSelection SockAddr) where , "actualKnown" .= actualKnown , "selectedPeers" .= toJSONList (toList sp) ] - forMachine _dtal (TracePeerShareRequests targetKnown actualKnown aps sps) = + forMachine _dtal (TracePeerShareRequests targetKnown actualKnown (PeerSharingAmount numRequested) aps sps) = mconcat [ "kind" .= String "PeerShareRequests" , "targetKnown" .= targetKnown , "actualKnown" .= actualKnown + , "numRequested" .= numRequested , "availablePeers" .= toJSONList (toList aps) , "selectedPeers" .= toJSONList (toList sps) ] diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index f777e0a36ad..e692cc5e8b2 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -84,7 +84,8 @@ import Ouroboros.Network.Protocol.LocalTxMonitor.Type (LocalTxMonitor) import qualified Ouroboros.Network.Protocol.LocalTxMonitor.Type as LocalTxMonitor import Ouroboros.Network.Protocol.LocalTxSubmission.Type (LocalTxSubmission) import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Type as LocalTxSub -import Ouroboros.Network.Protocol.PeerSharing.Type (PeerSharingResult (..)) +import Ouroboros.Network.Protocol.PeerSharing.Type (PeerSharingAmount (..), + PeerSharingResult (..)) import Ouroboros.Network.Protocol.TxSubmission2.Type as TxSubmission2 import Ouroboros.Network.RethrowPolicy (ErrorCommand (..)) import Ouroboros.Network.Server2 (ServerTrace (..)) @@ -1643,10 +1644,11 @@ instance ToObject (TracePeerSelection SockAddr) where , "actualKnown" .= actualKnown , "selectedPeers" .= Aeson.toJSONList (toList sp) ] - toObject _verb (TracePeerShareRequests targetKnown actualKnown aps sps) = + toObject _verb (TracePeerShareRequests targetKnown actualKnown (PeerSharingAmount numRequested) aps sps) = mconcat [ "kind" .= String "PeerShareRequests" , "targetKnown" .= targetKnown , "actualKnown" .= actualKnown + , "numRequested" .= numRequested , "availablePeers" .= Aeson.toJSONList (toList aps) , "selectedPeers" .= Aeson.toJSONList (toList sps) ] diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index e587c260290..c13ece99114 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -49,7 +49,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus-cardano - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-protocols , prometheus >= 2.2.4 , servant diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index 3dfabfd85ec..e036e33c847 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -63,7 +63,7 @@ library , network , network-mux , optparse-applicative-fork - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-api , prettyprinter , process diff --git a/cardano-tracer/cardano-tracer.cabal b/cardano-tracer/cardano-tracer.cabal index e2904cff589..d500c78d8bc 100644 --- a/cardano-tracer/cardano-tracer.cabal +++ b/cardano-tracer/cardano-tracer.cabal @@ -152,7 +152,7 @@ library , filepath , mime-mail , optparse-applicative - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-api , ouroboros-network-framework , signal diff --git a/flake.lock b/flake.lock index 9b0014d755c..1e72164db4a 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1710945682, - "narHash": "sha256-xp1txUjrtCuKHAy0nvz/lu0MlNdNnzvP8l2p9MFB73Y=", + "lastModified": 1712590917, + "narHash": "sha256-DgXSWHF5b/UtM+ACBWLPNtMNTSGQrmtl/ME7e7dheLo=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "8df2bf06e4525ec39c106cd2593e3c5fd7f2b081", + "rev": "251738d00d5799850c6eb610c4ab7b175b66224a", "type": "github" }, "original": { diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index bf3b07cf655..27ca7d3bad4 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -60,7 +60,7 @@ library , hostname , network , optparse-applicative-fork - , ouroboros-network ^>= 0.13 + , ouroboros-network ^>= 0.14 , ouroboros-network-api , ouroboros-network-framework , serialise From 424983fa186786397f5a99539f51710abf62c37b Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Tue, 9 Apr 2024 10:48:56 +0200 Subject: [PATCH 05/10] cardano-node-8.9.2 Also updated `copyright` field in the `cardano-node.cabal` file. --- cardano-node/NOTICE | 2 +- cardano-node/cardano-node.cabal | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cardano-node/NOTICE b/cardano-node/NOTICE index 73fe83fa3b1..47f18a85adc 100644 --- a/cardano-node/NOTICE +++ b/cardano-node/NOTICE @@ -1,4 +1,4 @@ -Copyright 2019-2023 Input Output Global Inc (IOG). +Copyright 2019-2023 Input Output Global Inc (IOG), 2023-2024 Intersect. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 37645eb6e9a..6661a9f26d3 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,12 +1,12 @@ cabal-version: 3.0 name: cardano-node -version: 8.9.1 +version: 8.9.2 synopsis: The cardano full node description: The cardano full node. category: Cardano, Validator, -copyright: 2019-2023 Input Output Global Inc (IOG). +copyright: 2019-2023 Input Output Global Inc (IOG), 2023-2024 Intersect. author: IOHK maintainer: operations@iohk.io license: Apache-2.0 From 0faa1c7ff9270059f2bd4234ea25421b1a6162aa Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Wed, 1 May 2024 13:35:39 +0200 Subject: [PATCH 06/10] Updated generate-release-changelog-links to GHC-9.8 --- scripts/generate-release-changelog-links.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate-release-changelog-links.hs b/scripts/generate-release-changelog-links.hs index 7c06c9e0506..84a39e61aca 100755 --- a/scripts/generate-release-changelog-links.hs +++ b/scripts/generate-release-changelog-links.hs @@ -1,4 +1,4 @@ -#!/usr/bin/env -S cabal run --verbose=1 --index-state=2023-10-04T00:00:00Z +#!/usr/bin/env -S cabal run --verbose=1 --index-state=2024-04-09T14:49:48Z {- cabal: build-depends: base, @@ -8,7 +8,7 @@ case-insensitive, containers, foldl, - github ^>= 0.28, + github ^>= 0.29, optparse-applicative ^>= 0.18, ansi-wl-pprint >= 1, pandoc ^>= 3.1, From a1f098f595368daeb0cfbd8b250519d9c3849fed Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Wed, 1 May 2024 13:35:58 +0200 Subject: [PATCH 07/10] cardano-node-8.9.3 Upgraded to `ouroboros-network-0.15.0.0` --- bench/locli/locli.cabal | 2 +- cabal.project | 2 +- cardano-node/cardano-node.cabal | 6 +- .../src/Cardano/Node/Tracing/Consistency.hs | 2 +- .../src/Cardano/Node/Tracing/Documentation.hs | 2 +- .../src/Cardano/Node/Tracing/Tracers.hs | 7 + .../src/Cardano/Node/Tracing/Tracers/P2P.hs | 290 ++++++++++++++---- .../Tracing/OrphanInstances/Network.hs | 117 +++++-- cardano-node/src/Cardano/Tracing/Tracers.hs | 110 ++++++- cardano-submit-api/cardano-submit-api.cabal | 2 +- cardano-testnet/cardano-testnet.cabal | 2 +- cardano-tracer/cardano-tracer.cabal | 2 +- flake.lock | 6 +- trace-dispatcher/trace-dispatcher.cabal | 2 +- 14 files changed, 442 insertions(+), 110 deletions(-) diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index a0e3173d9b4..01e294640ec 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -121,7 +121,7 @@ library , optparse-generic , ouroboros-consensus -- for Data.SOP.Strict: - , ouroboros-network ^>= 0.14 + , ouroboros-network ^>= 0.15 , ouroboros-network-api , process , quiet diff --git a/cabal.project b/cabal.project index f8ec5f6849a..8199d0aaef7 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-03-20T14:55:30Z - , cardano-haskell-packages 2024-04-08T15:27:49Z + , cardano-haskell-packages 2024-05-07T17:27:07Z packages: cardano-git-rev diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 6661a9f26d3..c65a880182f 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node -version: 8.9.2 +version: 8.9.3 synopsis: The cardano full node description: The cardano full node. category: Cardano, @@ -188,8 +188,8 @@ library , ouroboros-consensus-diffusion ^>= 0.14 , ouroboros-consensus-protocol , ouroboros-network-api ^>= 0.7 - , ouroboros-network ^>= 0.14 - , ouroboros-network-framework ^>= 0.12 + , ouroboros-network ^>= 0.15 + , ouroboros-network-framework ^>= 0.13 , ouroboros-network-protocols ^>= 0.8 , prettyprinter , prettyprinter-ansi-terminal diff --git a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs index d80519bebd6..846f5807d43 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs @@ -62,7 +62,7 @@ import qualified Ouroboros.Network.NodeToClient as NtC import Ouroboros.Network.NodeToNode (ErrorPolicyTrace (..), RemoteAddress, WithAddr (..)) import qualified Ouroboros.Network.NodeToNode as NtN import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..), - PeerSelectionCounters (..), TracePeerSelection (..)) + PeerSelectionCounters, TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.LedgerPeers (TraceLedgerPeers) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers diff --git a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs index bef9d5cb87b..2fdc5f908e8 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Documentation.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Documentation.hs @@ -71,7 +71,7 @@ import qualified Ouroboros.Network.NodeToClient as NtC import Ouroboros.Network.NodeToNode (ErrorPolicyTrace (..), RemoteAddress, WithAddr (..)) import qualified Ouroboros.Network.NodeToNode as NtN import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..), - PeerSelectionCounters (..), TracePeerSelection (..)) + PeerSelectionCounters, TracePeerSelection (..)) import Ouroboros.Network.PeerSelection.LedgerPeers (TraceLedgerPeers) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers.hs index b62ed90e8ac..e031c08a4fc 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers.hs @@ -539,6 +539,11 @@ mkDiffusionTracersExtra configReflection trBase trForward mbTrEKG _trDataPoint t ["Net", "PeerSelection"] configureTracers configReflection trConfig [peerSelectionCountersTr] + !churnCountersTr <- mkCardanoTracer + trBase trForward mbTrEKG + ["Net", "Churn"] + configureTracers configReflection trConfig [churnCountersTr] + !peerSelectionActionsTr <- mkCardanoTracer trBase trForward mbTrEKG ["Net", "PeerSelection", "Actions"] @@ -602,6 +607,8 @@ mkDiffusionTracersExtra configReflection trBase trForward mbTrEKG _trDataPoint t traceWith debugPeerSelectionResponderTr , P2P.dtTracePeerSelectionCounters = Tracer $ traceWith peerSelectionCountersTr + , P2P.dtTraceChurnCounters = Tracer $ + traceWith churnCountersTr , P2P.dtPeerSelectionActionsTracer = Tracer $ traceWith peerSelectionActionsTr , P2P.dtConnectionManagerTracer = Tracer $ diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 424abcd716c..4b536288e3f 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} @@ -8,6 +9,12 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -Wno-orphans #-} +-- needs different instances on ghc8 and on ghc9 +#if __GLASGOW_HASKELL__ < 904 +-- Pattern synonym record fields with GHC-8.10 is issuing the `-Wname-shadowing` +-- warning. +{-# OPTIONS_GHC -Wno-name-shadowing #-} +#endif module Cardano.Node.Tracing.Tracers.P2P () where @@ -26,19 +33,18 @@ import Ouroboros.Network.InboundGovernor (InboundGovernorTrace (..)) import qualified Ouroboros.Network.InboundGovernor as InboundGovernor import Ouroboros.Network.InboundGovernor.State (InboundGovernorCounters (..)) import qualified Ouroboros.Network.NodeToNode as NtN -import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..), - DebugPeerSelectionState (..), PeerSelectionCounters (..), - PeerSelectionState (..), PeerSelectionTargets (..), TracePeerSelection (..)) +import Ouroboros.Network.PeerSelection.Governor (ChurnCounters (..), + DebugPeerSelection (..), DebugPeerSelectionState (..), + PeerSelectionCounters , PeerSelectionView (..), + PeerSelectionState (..), PeerSelectionTargets (..), + TracePeerSelection (..), peerSelectionStateToCounters) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint) import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers (TraceLocalRootPeers (..)) import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers (TracePublicRootPeers (..)) -import qualified Ouroboros.Network.PeerSelection.State.EstablishedPeers as EstablishedPeers import qualified Ouroboros.Network.PeerSelection.State.KnownPeers as KnownPeers -import Ouroboros.Network.PeerSelection.State.LocalRootPeers (HotValency (..), - WarmValency (..)) import Ouroboros.Network.PeerSelection.Types () import Ouroboros.Network.Protocol.PeerSharing.Type (PeerSharingAmount (..)) import Ouroboros.Network.RethrowPolicy (ErrorCommand (..)) @@ -492,10 +498,13 @@ instance LogFormatting (TracePeerSelection SockAddr) where forMachine _dtal (TraceChurnMode c) = mconcat [ "kind" .= String "ChurnMode" , "event" .= show c ] - forMachine _dtal (TraceKnownInboundConnection addr sharing) = - mconcat [ "kind" .= String "KnownInboundConnection" - , "peer" .= toJSON addr - , "peerSharing" .= String (pack . show $ sharing) ] + forMachine _dtal (TracePickInboundPeers targetNumberOfKnownPeers numberOfKnownPeers selected available) = + mconcat [ "kind" .= String "PickInboundPeers" + , "targetKnown" .= targetNumberOfKnownPeers + , "actualKnown" .= numberOfKnownPeers + , "selected" .= selected + , "available" .= available + ] forMachine _dtal (TraceLedgerStateJudgementChanged new) = mconcat [ "kind" .= String "LedgerStateJudgementChanged" , "new" .= show new ] @@ -511,6 +520,18 @@ instance LogFormatting (TracePeerSelection SockAddr) where mconcat [ "kind" .= String "OutboundGovernorCriticalFailure" , "reason" .= show err ] + forMachine _dtal (TraceChurnAction duration action counter) = + mconcat [ "kind" .= String "ChurnAction" + , "action" .= show action + , "counter" .= counter + , "duration" .= duration + ] + forMachine _dtal (TraceChurnTimeout duration action counter) = + mconcat [ "kind" .= String "ChurnTimeout" + , "action" .= show action + , "counter" .= counter + , "duration" .= duration + ] forMachine _dtal (TraceDebugState mtime ds) = mconcat [ "kind" .= String "DebugState" , "monotonicTime" .= show mtime @@ -537,6 +558,12 @@ instance LogFormatting (TracePeerSelection SockAddr) where forHuman = pack . show + asMetrics (TraceChurnAction duration action _) = + [ DoubleM ("Net.PeerSelection.Churn." <> pack (show action) <> ".duration") + (realToFrac duration) + ] + asMetrics _ = [] + instance MetaTrace (TracePeerSelection SockAddr) where namespaceFor TraceLocalRootPeersChanged {} = Namespace [] ["LocalRootPeersChanged"] @@ -634,8 +661,8 @@ instance MetaTrace (TracePeerSelection SockAddr) where Namespace [] ["ChurnWait"] namespaceFor TraceChurnMode {} = Namespace [] ["ChurnMode"] - namespaceFor TraceKnownInboundConnection {} = - Namespace [] ["KnownInboundConnection"] + namespaceFor TracePickInboundPeers {} = + Namespace [] ["PickInboundPeers"] namespaceFor TraceLedgerStateJudgementChanged {} = Namespace [] ["LedgerStateJudgementChanged"] namespaceFor TraceOnlyBootstrapPeers {} = @@ -646,6 +673,10 @@ instance MetaTrace (TracePeerSelection SockAddr) where Namespace [] ["BootstrapPeersFlagChangedWhilstInSensitiveState"] namespaceFor TraceOutboundGovernorCriticalFailure {} = Namespace [] ["OutboundGovernorCriticalFailure"] + namespaceFor TraceChurnAction {} = + Namespace [] ["ChurnAction"] + namespaceFor TraceChurnTimeout {} = + Namespace [] ["ChurnTimeout"] namespaceFor TraceDebugState {} = Namespace [] ["DebugState"] @@ -678,8 +709,10 @@ instance MetaTrace (TracePeerSelection SockAddr) where severityFor (Namespace [] ["GovernorWakeup"]) _ = Just Info severityFor (Namespace [] ["ChurnWait"]) _ = Just Info severityFor (Namespace [] ["ChurnMode"]) _ = Just Info - severityFor (Namespace [] ["KnownInboundConnection"]) _ = Just Info + severityFor (Namespace [] ["PickInboundPeers"]) _ = Just Info severityFor (Namespace [] ["OutboundGovernorCriticalFailure"]) _ = Just Error + severityFor (Namespace [] ["ChurnAction"]) _ = Just Info + severityFor (Namespace [] ["ChurnTimeout"]) _ = Just Notice severityFor (Namespace [] ["DebugState"]) _ = Just Info severityFor _ _ = Nothing @@ -733,7 +766,7 @@ instance MetaTrace (TracePeerSelection SockAddr) where documentFor (Namespace [] ["GovernorWakeup"]) = Just "" documentFor (Namespace [] ["ChurnWait"]) = Just "" documentFor (Namespace [] ["ChurnMode"]) = Just "" - documentFor (Namespace [] ["KnownInboundConnection"]) = Just + documentFor (Namespace [] ["PickInboundPeers"]) = Just "An inbound connection was added to known set of outbound governor" documentFor (Namespace [] ["OutboundGovernorCriticalFailure"]) = Just "Outbound Governor was killed unexpectedly" @@ -771,7 +804,7 @@ instance MetaTrace (TracePeerSelection SockAddr) where , Namespace [] ["GovernorWakeup"] , Namespace [] ["ChurnWait"] , Namespace [] ["ChurnMode"] - , Namespace [] ["KnownInboundConnection"] + , Namespace [] ["PickInboundPeers"] , Namespace [] ["OutboundGovernorCriticalFailure"] , Namespace [] ["DebugState"] ] @@ -781,17 +814,13 @@ instance MetaTrace (TracePeerSelection SockAddr) where -------------------------------------------------------------------------------- instance LogFormatting (DebugPeerSelection SockAddr) where - forMachine DNormal (TraceGovernorState blockedAt wakeupAfter - PeerSelectionState { targets, knownPeers, establishedPeers, activePeers }) = + forMachine dtal@DNormal (TraceGovernorState blockedAt wakeupAfter + st@PeerSelectionState { targets }) = mconcat [ "kind" .= String "DebugPeerSelection" , "blockedAt" .= String (pack $ show blockedAt) , "wakeupAfter" .= String (pack $ show wakeupAfter) , "targets" .= peerSelectionTargetsToObject targets - , "numberOfPeers" .= - Object (mconcat [ "known" .= KnownPeers.size knownPeers - , "established" .= EstablishedPeers.size establishedPeers - , "active" .= Set.size activePeers - ]) + , "counters" .= forMachine dtal (peerSelectionStateToCounters st) ] forMachine _ (TraceGovernorState blockedAt wakeupAfter ev) = mconcat [ "kind" .= String "DebugPeerSelection" @@ -840,43 +869,123 @@ instance MetaTrace (DebugPeerSelection SockAddr) where -------------------------------------------------------------------------------- instance LogFormatting PeerSelectionCounters where - forMachine _dtal ev = + forMachine _dtal PeerSelectionCounters {..} = mconcat [ "kind" .= String "PeerSelectionCounters" - , "coldPeers" .= coldPeers ev - , "warmPeers" .= warmPeers ev - , "hotPeers" .= hotPeers ev - , "coldBigLedgerPeers" .= coldBigLedgerPeers ev - , "warmBigLedgerPeers" .= warmBigLedgerPeers ev - , "hotBigLedgerPeers" .= hotBigLedgerPeers ev - , "localRoots" .= toJSON (localRoots ev) + + , "knownPeers" .= numberOfKnownPeers + , "rootPeers" .= numberOfRootPeers + , "coldPeersPromotions" .= numberOfColdPeersPromotions + , "establishedPeers" .= numberOfEstablishedPeers + , "warmPeersDemotions" .= numberOfWarmPeersDemotions + , "warmPeersPromotions" .= numberOfWarmPeersPromotions + , "activePeers" .= numberOfActivePeers + , "activePeersDemotions" .= numberOfActivePeersDemotions + + , "knownBigLedgerPeers" .= numberOfKnownBigLedgerPeers + , "coldBigLedgerPeersPromotions" .= numberOfColdBigLedgerPeersPromotions + , "establishedBigLedgerPeers" .= numberOfEstablishedBigLedgerPeers + , "warmBigLedgerPeersDemotions" .= numberOfWarmBigLedgerPeersDemotions + , "warmBigLedgerPeersPromotions" .= numberOfWarmBigLedgerPeersPromotions + , "activeBigLedgerPeers" .= numberOfActiveBigLedgerPeers + , "activeBigLedgerPeersDemotions" .= numberOfActiveBigLedgerPeersDemotions + + , "knownLocalRootPeers" .= numberOfKnownLocalRootPeers + , "establishedLocalRootPeers" .= numberOfEstablishedLocalRootPeers + , "warmLocalRootPeersPromotions" .= numberOfWarmLocalRootPeersPromotions + , "activeLocalRootPeers" .= numberOfActiveLocalRootPeers + , "activeLocalRootPeersDemotions" .= numberOfActiveLocalRootPeersDemotions + + , "knownNonRootPeers" .= numberOfKnownNonRootPeers + , "coldNonRootPeersPromotions" .= numberOfColdNonRootPeersPromotions + , "establishedNonRootPeers" .= numberOfEstablishedNonRootPeers + , "warmNonRootPeersDemotions" .= numberOfWarmNonRootPeersDemotions + , "warmNonRootPeersPromotions" .= numberOfWarmNonRootPeersPromotions + , "activeNonRootPeers" .= numberOfActiveNonRootPeers + , "activeNonRootPeersDemotions" .= numberOfActiveNonRootPeersDemotions + + , "knownBootstrapPeers" .= numberOfKnownBootstrapPeers + , "coldBootstrapPeersPromotions" .= numberOfColdBootstrapPeersPromotions + , "establishedBootstrapPeers" .= numberOfEstablishedBootstrapPeers + , "warmBootstrapPeersDemotions" .= numberOfWarmBootstrapPeersDemotions + , "warmBootstrapPeersPromotions" .= numberOfWarmBootstrapPeersPromotions + , "activeBootstrapPeers" .= numberOfActiveBootstrapPeers + , "ActiveBootstrapPeersDemotions" .= numberOfActiveBootstrapPeersDemotions ] forHuman = pack . show - asMetrics PeerSelectionCounters {..} = - [ IntM - "Net.PeerSelection.Cold" - (fromIntegral coldPeers) - , IntM - "Net.PeerSelection.Warm" - (fromIntegral warmPeers) - , IntM - "Net.PeerSelection.Hot" - (fromIntegral hotPeers) - , IntM - "Net.PeerSelection.ColdBigLedgerPeers" - (fromIntegral coldBigLedgerPeers) - , IntM - "Net.PeerSelection.WarmBigLedgerPeers" - (fromIntegral warmBigLedgerPeers) - , IntM - "Net.PeerSelection.HotBigLedgerPeers" - (fromIntegral hotBigLedgerPeers) - , IntM - "Net.PeerSelection.WarmLocalRoots" - (fromIntegral $ getWarmValency $ foldl' (\a (_, b) -> a + b) 0 localRoots) - , IntM - "Net.PeerSelection.HotLocalRoots" - (fromIntegral $ getHotValency $ foldl' (\a (b, _) -> a + b) 0 localRoots) - ] + asMetrics psc = + case psc of + PeerSelectionCountersHWC {..} -> + -- Deprecated metrics; they will be removed in a future version. + [ IntM + "Net.PeerSelection.Cold" + (fromIntegral numberOfColdPeers) + , IntM + "Net.PeerSelection.Warm" + (fromIntegral numberOfWarmPeers) + , IntM + "Net.PeerSelection.Hot" + (fromIntegral numberOfHotPeers) + , IntM + "Net.PeerSelection.ColdBigLedgerPeers" + (fromIntegral numberOfColdBigLedgerPeers) + , IntM + "Net.PeerSelection.WarmBigLedgerPeers" + (fromIntegral numberOfWarmBigLedgerPeers) + , IntM + "Net.PeerSelection.HotBigLedgerPeers" + (fromIntegral numberOfHotBigLedgerPeers) + + , IntM + "Net.PeerSelection.WarmLocalRoots" + (fromIntegral $ numberOfActiveLocalRootPeers psc) + , IntM + "Net.PeerSelection.HotLocalRoots" + (fromIntegral $ numberOfEstablishedLocalRootPeers psc + - numberOfActiveLocalRootPeers psc) + ] + ++ + case psc of + PeerSelectionCounters {..} -> + [ IntM "Net.PeerSelection.RootPeers" (fromIntegral numberOfRootPeers) + + , IntM "Net.PeerSelection.KnownPeers" (fromIntegral numberOfKnownPeers) + , IntM "Net.PeerSelection.ColdPeersPromotions" (fromIntegral numberOfColdPeersPromotions) + , IntM "Net.PeerSelection.EstablishedPeers" (fromIntegral numberOfEstablishedPeers) + , IntM "Net.PeerSelection.WarmPeersDemotions" (fromIntegral numberOfWarmPeersDemotions) + , IntM "Net.PeerSelection.WarmPeersPromotions" (fromIntegral numberOfWarmPeersPromotions) + , IntM "Net.PeerSelection.ActivePeers" (fromIntegral numberOfActivePeers) + , IntM "Net.PeerSelection.ActivePeersDemotions" (fromIntegral numberOfActivePeersDemotions) + + , IntM "Net.PeerSelection.KnownBigLedgerPeers" (fromIntegral numberOfKnownBigLedgerPeers) + , IntM "Net.PeerSelection.ColdBigLedgerPeersPromotions" (fromIntegral numberOfColdBigLedgerPeersPromotions) + , IntM "Net.PeerSelection.EstablishedBigLedgerPeers" (fromIntegral numberOfEstablishedBigLedgerPeers) + , IntM "Net.PeerSelection.WarmBigLedgerPeersDemotions" (fromIntegral numberOfWarmBigLedgerPeersDemotions) + , IntM "Net.PeerSelection.WarmBigLedgerPeersPromotions" (fromIntegral numberOfWarmBigLedgerPeersPromotions) + , IntM "Net.PeerSelection.ActiveBigLedgerPeers" (fromIntegral numberOfActiveBigLedgerPeers) + , IntM "Net.PeerSelection.ActiveBigLedgerPeersDemotions" (fromIntegral numberOfActiveBigLedgerPeersDemotions) + + , IntM "Net.PeerSelection.KnownLocalRootPeers" (fromIntegral numberOfKnownLocalRootPeers) + , IntM "Net.PeerSelection.EstablishedLocalRootPeers" (fromIntegral numberOfEstablishedLocalRootPeers) + , IntM "Net.PeerSelection.WarmLocalRootPeersPromotions" (fromIntegral numberOfWarmLocalRootPeersPromotions) + , IntM "Net.PeerSelection.ActiveLocalRootPeers" (fromIntegral numberOfActiveLocalRootPeers) + , IntM "Net.PeerSelection.ActiveLocalRootPeersDemotions" (fromIntegral numberOfActiveLocalRootPeersDemotions) + + , IntM "Net.PeerSelection.KnownNonRootPeers" (fromIntegral numberOfKnownNonRootPeers) + , IntM "Net.PeerSelection.ColdNonRootPeersPromotions" (fromIntegral numberOfColdNonRootPeersPromotions) + , IntM "Net.PeerSelection.EstablishedNonRootPeers" (fromIntegral numberOfEstablishedNonRootPeers) + , IntM "Net.PeerSelection.WarmNonRootPeersDemotions" (fromIntegral numberOfWarmNonRootPeersDemotions) + , IntM "Net.PeerSelection.WarmNonRootPeersPromotions" (fromIntegral numberOfWarmNonRootPeersPromotions) + , IntM "Net.PeerSelection.ActiveNonRootPeers" (fromIntegral numberOfActiveNonRootPeers) + , IntM "Net.PeerSelection.ActiveNonRootPeersDemotions" (fromIntegral numberOfActiveNonRootPeersDemotions) + + , IntM "Net.PeerSelection.KnownBootstrapPeers" (fromIntegral numberOfKnownBootstrapPeers) + , IntM "Net.PeerSelection.ColdBootstrapPeersPromotions" (fromIntegral numberOfColdBootstrapPeersPromotions) + , IntM "Net.PeerSelection.EstablishedBootstrapPeers" (fromIntegral numberOfEstablishedBootstrapPeers) + , IntM "Net.PeerSelection.WarmBootstrapPeersDemotions" (fromIntegral numberOfWarmBootstrapPeersDemotions) + , IntM "Net.PeerSelection.WarmBootstrapPeersPromotions" (fromIntegral numberOfWarmBootstrapPeersPromotions) + , IntM "Net.PeerSelection.ActiveBootstrapPeers" (fromIntegral numberOfActiveBootstrapPeers) + , IntM "Net.PeerSelection.ActiveBootstrapPeersDemotions" (fromIntegral numberOfActiveBootstrapPeersDemotions) + ] instance MetaTrace PeerSelectionCounters where namespaceFor PeerSelectionCounters {} = Namespace [] ["Counters"] @@ -885,7 +994,7 @@ instance MetaTrace PeerSelectionCounters where severityFor _ _ = Nothing documentFor (Namespace _ ["Counters"]) = Just - "Counters for cold, warm and hot peers" + "Counters of selected peers" documentFor _ = Nothing metricsDocFor (Namespace _ ["Counters"]) = @@ -904,6 +1013,54 @@ instance MetaTrace PeerSelectionCounters where ] +-------------------------------------------------------------------------------- +-- ChurnCounters Tracer +-------------------------------------------------------------------------------- + + +instance LogFormatting ChurnCounters where + forMachine _dtal (ChurnCounter action c) = + mconcat [ "kind" .= String "ChurnCounter" + , "action" .= String (pack $ show action) + , "counter" .= c + ] + asMetrics (ChurnCounter action c) = + [ IntM + ("Net.Churn." <> pack (show action)) + (fromIntegral c) + ] + +instance MetaTrace ChurnCounters where + namespaceFor ChurnCounter {} = Namespace [] ["ChurnCounters"] + + severityFor (Namespace _ ["ChurnCounters"]) _ = Just Info + severityFor _ _ = Nothing + + documentFor (Namespace _ ["ChurnCounters"]) = Just + "churn counters" + documentFor _ = Nothing + + metricsDocFor (Namespace _ ["Counters"]) = + [ ("Net.Churn.DecreasedActivePeers", "number of decreased active peers") + , ("Net.Churn.IncreasedActivePeers", "number of increased active peers") + , ("Net.Churn.DecreasedActiveBigLedgerPeers", "number of decreased active big ledger peers") + , ("Net.Churn.IncreasedActiveBigLedgerPeers", "number of increased active big ledger peers") + , ("Net.Churn.DecreasedEstablishedPeers", "number of decreased established peers") + , ("Net.Churn.IncreasedEstablishedPeers", "number of increased established peers") + , ("Net.Churn.IncreasedEstablishedBigLedgerPeers", "number of increased established big ledger peers") + , ("Net.Churn.DecreasedEstablishedBigLedgerPeers", "number of decreased established big ledger peers") + , ("Net.Churn.DecreasedKnownPeers", "number of decreased known peers") + , ("Net.Churn.IncreasedKnownPeers", "number of increased known peers") + , ("Net.Churn.DecreasedKnownBigLedgerPeers", "number of decreased known big ledger peers") + , ("Net.Churn.IncreasedKnownBigLedgerPeers", "number of increased known big ledger peers") + ] + metricsDocFor _ = [] + + allNamespaces =[ + Namespace [] ["ChurnCounters"] + ] + + -------------------------------------------------------------------------------- -- PeerSelectionActions Tracer -------------------------------------------------------------------------------- @@ -1480,6 +1637,15 @@ forMachineGov _dtal (InboundGovernor.TrInboundGovernorError err) = mconcat [ "kind" .= String "InboundGovernorError" , "remoteSt" .= String (pack . show $ err) ] +forMachineGov _dtal (InboundGovernor.TrMaturedConnections matured fresh) = + mconcat [ "kind" .= String "MaturedConnections" + , "matured" .= toJSON matured + , "fresh" .= toJSON fresh + ] +forMachineGov _dtal (InboundGovernor.TrInactive fresh) = + mconcat [ "kind" .= String "Inactive" + , "fresh" .= toJSON fresh + ] instance MetaTrace (InboundGovernorTrace addr) where namespaceFor TrNewConnection {} = Namespace [] ["NewConnection"] @@ -1501,6 +1667,10 @@ instance MetaTrace (InboundGovernorTrace addr) where Namespace [] ["UnexpectedlyFalseAssertion"] namespaceFor InboundGovernor.TrInboundGovernorError {} = Namespace [] ["InboundGovernorError"] + namespaceFor InboundGovernor.TrMaturedConnections {} = + Namespace [] ["MaturedConnections"] + namespaceFor InboundGovernor.TrInactive {} = + Namespace [] ["Inactive"] severityFor (Namespace _ ["NewConnection"]) _ = Just Debug severityFor (Namespace _ ["ResponderRestarted"]) _ = Just Debug @@ -1519,6 +1689,8 @@ instance MetaTrace (InboundGovernorTrace addr) where severityFor (Namespace _ ["RemoteState"]) _ = Just Debug severityFor (Namespace _ ["UnexpectedlyFalseAssertion"]) _ = Just Error severityFor (Namespace _ ["InboundGovernorError"]) _ = Just Error + severityFor (Namespace _ ["MaturedConnections"]) _ = Just Info + severityFor (Namespace _ ["Inactive"]) _ = Just Debug severityFor _ _ = Nothing documentFor (Namespace _ ["NewConnection"]) = Just "" @@ -1544,6 +1716,8 @@ instance MetaTrace (InboundGovernorTrace addr) where documentFor (Namespace _ ["RemoteState"]) = Just "" documentFor (Namespace _ ["UnexpectedlyFalseAssertion"]) = Just "" documentFor (Namespace _ ["InboundGovernorError"]) = Just "" + documentFor (Namespace _ ["MaturedConnections"]) = Just "" + documentFor (Namespace _ ["Inactive"]) = Just "" documentFor _ = Nothing metricsDocFor (Namespace [] ["InboundGovernorCounters"]) = @@ -1586,6 +1760,8 @@ instance MetaTrace (InboundGovernorTrace addr) where , Namespace [] ["RemoteState"] , Namespace [] ["UnexpectedlyFalseAssertion"] , Namespace [] ["InboundGovernorError"] + , Namespace [] ["MaturedConnections"] + , Namespace [] ["Inactive"] ] -------------------------------------------------------------------------------- diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index e692cc5e8b2..1b89661c375 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -6,6 +7,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} @@ -13,6 +15,11 @@ {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} +#if __GLASGOW_HASKELL__ < 904 +-- Pattern synonym record fields with GHC-8.10 is issuing the `-Wname-shadowing` +-- warning. +{-# OPTIONS_GHC -Wno-name-shadowing #-} +#endif module Cardano.Tracing.OrphanInstances.Network () where @@ -54,8 +61,10 @@ import Ouroboros.Network.NodeToNode (ErrorPolicyTrace (..), NodeToNode import qualified Ouroboros.Network.NodeToNode as NtN import Ouroboros.Network.PeerSelection.Bootstrap import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..), - DebugPeerSelectionState (..), PeerSelectionCounters (..), - PeerSelectionState (..), PeerSelectionTargets (..), TracePeerSelection (..)) + DebugPeerSelectionState (..), PeerSelectionCounters, + PeerSelectionView (..), PeerSelectionState (..), + PeerSelectionTargets (..), TracePeerSelection (..), + peerSelectionStateToCounters) import Ouroboros.Network.PeerSelection.LedgerPeers import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..)) import Ouroboros.Network.PeerSelection.PeerStateActions (PeerSelectionActionsTrace (..)) @@ -66,7 +75,6 @@ import Ouroboros.Network.PeerSelection.RootPeersDNS.LocalRootPeers (TraceLocalRootPeers (..)) import Ouroboros.Network.PeerSelection.RootPeersDNS.PublicRootPeers (TracePublicRootPeers (..)) -import qualified Ouroboros.Network.PeerSelection.State.EstablishedPeers as EstablishedPeers import Ouroboros.Network.PeerSelection.State.KnownPeers (KnownPeerInfo (..)) import qualified Ouroboros.Network.PeerSelection.State.KnownPeers as KnownPeers import Ouroboros.Network.PeerSelection.State.LocalRootPeers (HotValency (..), @@ -415,6 +423,7 @@ instance HasSeverityAnnotation (TracePeerSelection addr) where TracePeerShareRequests {} -> Info TracePeerShareResults {} -> Info TracePeerShareResultsFiltered {} -> Debug + TracePickInboundPeers {} -> Info TraceForgetColdPeers {} -> Info TracePromoteColdPeers {} -> Info TracePromoteColdLocalPeers {} -> Info @@ -437,7 +446,6 @@ instance HasSeverityAnnotation (TracePeerSelection addr) where TraceGovernorWakeup {} -> Info TraceChurnWait {} -> Info TraceChurnMode {} -> Info - TraceKnownInboundConnection {} -> Info TraceForgetBigLedgerPeers {} -> Info @@ -472,6 +480,9 @@ instance HasSeverityAnnotation (TracePeerSelection addr) where TraceOutboundGovernorCriticalFailure {} -> Error + TraceChurnAction {} -> Info + TraceChurnTimeout {} -> Notice + TraceDebugState {} -> Info instance HasPrivacyAnnotation (DebugPeerSelection addr) @@ -562,6 +573,8 @@ instance HasSeverityAnnotation (InboundGovernorTrace addr) where InboundGovernor.TrUnexpectedlyFalseAssertion {} -> Error InboundGovernor.TrInboundGovernorError {} -> Error + InboundGovernor.TrMaturedConnections {} -> Info + InboundGovernor.TrInactive {} -> Debug instance HasPrivacyAnnotation (Server.RemoteTransitionTrace addr) instance HasSeverityAnnotation (Server.RemoteTransitionTrace addr) where @@ -1869,10 +1882,13 @@ instance ToObject (TracePeerSelection SockAddr) where toObject _verb (TraceChurnMode c) = mconcat [ "kind" .= String "ChurnMode" , "event" .= show c ] - toObject _verb (TraceKnownInboundConnection addr sharing) = - mconcat [ "kind" .= String "KnownInboundConnection" - , "peer" .= show addr - , "peerSharing" .= show sharing ] + toObject _verb (TracePickInboundPeers targetNumberOfKnownPeers numberOfKnownPeers selected available) = + mconcat [ "kind" .= String "PickInboundPeers" + , "targetKnown" .= targetNumberOfKnownPeers + , "actualKnown" .= numberOfKnownPeers + , "selected" .= selected + , "available" .= available + ] toObject _verb (TraceLedgerStateJudgementChanged new) = mconcat [ "kind" .= String "LedgerStateJudgementChanged" , "new" .= show new ] @@ -1888,6 +1904,18 @@ instance ToObject (TracePeerSelection SockAddr) where mconcat [ "kind" .= String "OutboundGovernorCriticalFailure" , "reason" .= show err ] + toObject _verb (TraceChurnAction duration action counter) = + mconcat [ "kind" .= String "ChurnAction" + , "action" .= show action + , "counter" .= counter + , "duration" .= duration + ] + toObject _verb (TraceChurnTimeout duration action counter) = + mconcat [ "kind" .= String "ChurnTimeout" + , "action" .= show action + , "counter" .= counter + , "duration" .= duration + ] toObject _verb (TraceDebugState mtime ds) = mconcat [ "kind" .= String "DebugState" , "monotonicTime" .= mtime @@ -1973,26 +2001,15 @@ peerSelectionTargetsToObject instance ToObject (DebugPeerSelection SockAddr) where toObject verb (TraceGovernorState blockedAt wakeupAfter - PeerSelectionState { targets, knownPeers, establishedPeers, activePeers, publicRootPeers }) + st@PeerSelectionState { targets }) | verb <= NormalVerbosity = mconcat [ "kind" .= String "DebugPeerSelection" , "blockedAt" .= String (pack $ show blockedAt) , "wakeupAfter" .= String (pack $ show wakeupAfter) , "targets" .= peerSelectionTargetsToObject targets - , "numberOfPeers" .= - Object (mconcat [ "known" .= KnownPeers.size knownPeers - , "established" .= EstablishedPeers.size establishedPeers - , "active" .= Set.size activePeers - ]) - , "numberOfBigLedgerPeers" .= - Object (mconcat [ "known" .= Set.size (KnownPeers.toSet knownPeers `Set.intersection` bigLedgerPeers) - , "established" .= Set.size (EstablishedPeers.toSet establishedPeers `Set.intersection` bigLedgerPeers) - , "active" .= Set.size (activePeers `Set.intersection` bigLedgerPeers) - ]) + , "counters" .= toObject verb (peerSelectionStateToCounters st) ] - where - bigLedgerPeers = PublicRootPeers.getBigLedgerPeers publicRootPeers toObject _ (TraceGovernorState blockedAt wakeupAfter ev) = mconcat [ "kind" .= String "DebugPeerSelection" , "blockedAt" .= String (pack $ show blockedAt) @@ -2024,15 +2041,48 @@ instance Show lAddr => ToObject (PeerSelectionActionsTrace SockAddr lAddr) where ] instance ToObject PeerSelectionCounters where - toObject _verb ev = + toObject _verb PeerSelectionCounters {..} = mconcat [ "kind" .= String "PeerSelectionCounters" - , "coldPeers" .= coldPeers ev - , "warmPeers" .= warmPeers ev - , "hotPeers" .= hotPeers ev - , "coldBigLedgerPeers" .= coldBigLedgerPeers ev - , "warmBigLedgerPeers" .= warmBigLedgerPeers ev - , "hotBigLedgerPeers" .= hotBigLedgerPeers ev - ] + + , "knownPeers" .= numberOfKnownPeers + , "rootPeers" .= numberOfRootPeers + , "coldPeersPromotions" .= numberOfColdPeersPromotions + , "establishedPeers" .= numberOfEstablishedPeers + , "warmPeersDemotions" .= numberOfWarmPeersDemotions + , "warmPeersPromotions" .= numberOfWarmPeersPromotions + , "activePeers" .= numberOfActivePeers + , "activePeersDemotions" .= numberOfActivePeersDemotions + + , "knownBigLedgerPeers" .= numberOfKnownBigLedgerPeers + , "coldBigLedgerPeersPromotions" .= numberOfColdBigLedgerPeersPromotions + , "establishedBigLedgerPeers" .= numberOfEstablishedBigLedgerPeers + , "warmBigLedgerPeersDemotions" .= numberOfWarmBigLedgerPeersDemotions + , "warmBigLedgerPeersPromotions" .= numberOfWarmBigLedgerPeersPromotions + , "activeBigLedgerPeers" .= numberOfActiveBigLedgerPeers + , "activeBigLedgerPeersDemotions" .= numberOfActiveBigLedgerPeersDemotions + + , "knownLocalRootPeers" .= numberOfKnownLocalRootPeers + , "establishedLocalRootPeers" .= numberOfEstablishedLocalRootPeers + , "warmLocalRootPeersPromotions" .= numberOfWarmLocalRootPeersPromotions + , "activeLocalRootPeers" .= numberOfActiveLocalRootPeers + , "activeLocalRootPeersDemotions" .= numberOfActiveLocalRootPeersDemotions + + , "knownNonRootPeers" .= numberOfKnownNonRootPeers + , "coldNonRootPeersPromotions" .= numberOfColdNonRootPeersPromotions + , "establishedNonRootPeers" .= numberOfEstablishedNonRootPeers + , "warmNonRootPeersDemotions" .= numberOfWarmNonRootPeersDemotions + , "warmNonRootPeersPromotions" .= numberOfWarmNonRootPeersPromotions + , "activeNonRootPeers" .= numberOfActiveNonRootPeers + , "activeNonRootPeersDemotions" .= numberOfActiveNonRootPeersDemotions + + , "knownBootstrapPeers" .= numberOfKnownBootstrapPeers + , "coldBootstrapPeersPromotions" .= numberOfColdBootstrapPeersPromotions + , "establishedBootstrapPeers" .= numberOfEstablishedBootstrapPeers + , "warmBootstrapPeersDemotions" .= numberOfWarmBootstrapPeersDemotions + , "warmBootstrapPeersPromotions" .= numberOfWarmBootstrapPeersPromotions + , "activeBootstrapPeers" .= numberOfActiveBootstrapPeers + , "activeBootstrapPeersDemotions" .= numberOfActiveBootstrapPeersDemotions + ] instance (Show (ClientHasAgency st), Show (ServerHasAgency st)) => ToJSON (PeerHasAgency pr st) where @@ -2515,6 +2565,15 @@ instance (ToJSON addr, Show addr) mconcat [ "kind" .= String "InboundGovernorError" , "remoteSt" .= String (pack . show $ err) ] + toObject _verb (InboundGovernor.TrMaturedConnections matured fresh) = + mconcat [ "kind" .= String "MaturedConnections" + , "matured" .= toJSON matured + , "fresh" .= toJSON fresh + ] + toObject _verb (InboundGovernor.TrInactive fresh) = + mconcat [ "kind" .= String "Inactive" + , "fresh" .= toJSON fresh + ] instance ToJSON addr => ToObject (Server.RemoteTransitionTrace addr) where diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index 497e4879d0e..073704aaf4a 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} @@ -11,6 +12,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} @@ -19,6 +21,11 @@ {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -fno-warn-redundant-constraints #-} -- needs different instances on ghc8 and on ghc9 +#if __GLASGOW_HASKELL__ < 904 +-- Pattern synonym record fields with GHC-8.10 is issuing the `-Wname-shadowing` +-- warning. +{-# OPTIONS_GHC -Wno-name-shadowing #-} +#endif module Cardano.Tracing.Tracers @@ -93,7 +100,9 @@ import Ouroboros.Network.InboundGovernor (InboundGovernorTrace (..)) import Ouroboros.Network.InboundGovernor.State (InboundGovernorCounters (..)) import Ouroboros.Network.NodeToClient (LocalAddress) import Ouroboros.Network.NodeToNode (RemoteAddress) -import Ouroboros.Network.PeerSelection.Governor (PeerSelectionCounters (..)) +import Ouroboros.Network.PeerSelection.Governor (ChurnCounters (..), + PeerSelectionCounters, PeerSelectionView (..)) +import qualified Ouroboros.Network.PeerSelection.Governor as Governor import Ouroboros.Network.Point (fromWithOrigin) import Ouroboros.Network.Protocol.LocalStateQuery.Type (ShowQuery) import Ouroboros.Network.TxSubmission.Inbound @@ -363,8 +372,14 @@ mkTracers blockConfig tOpts@(TracingOnLegacy trSel) tr nodeKern ekgDirect enable tracerOnOff (tracePublicRootPeers trSel) verb "PublicRootPeers" tr , P2P.dtTracePeerSelectionTracer = - tracerOnOff (tracePeerSelection trSel) - verb "PeerSelection" tr + tracerOnOff (tracePeerSelection trSel) + verb "PeerSelection" tr + <> tracePeerSelectionTracerMetrics + (tracePeerSelection trSel) + ekgDirect + , P2P.dtTraceChurnCounters = + traceChurnCountersMetrics + ekgDirect , P2P.dtDebugPeerSelectionInitiatorTracer = tracerOnOff (traceDebugPeerSelectionInitiatorTracer trSel) verb "DebugPeerSelection" tr @@ -1447,6 +1462,26 @@ traceConnectionManagerTraceMetrics (OnOff True) (Just ekgDirect) = cmtTracer _ -> return () +tracePeerSelectionTracerMetrics + :: forall peeraddr. + OnOff TracePeerSelection + -> Maybe EKGDirect + -> Tracer IO (Governor.TracePeerSelection peeraddr) +tracePeerSelectionTracerMetrics _ Nothing = nullTracer +tracePeerSelectionTracerMetrics (OnOff False) _ = nullTracer +tracePeerSelectionTracerMetrics (OnOff True) (Just ekgDirect) = pstTracer + where + pstTracer :: Tracer IO (Governor.TracePeerSelection peeraddr) + pstTracer = Tracer $ \a -> do + case a of + Governor.TraceChurnAction duration action _ -> + sendEKGDirectDouble + ekgDirect + ("cardano.node.metrics.peerSelection.churn." <> Text.pack (show action) <> ".duration") + (realToFrac duration) + _ -> pure () + + tracePeerSelectionCountersMetrics :: OnOff TracePeerSelectionCounters -> Maybe EKGDirect @@ -1456,13 +1491,68 @@ tracePeerSelectionCountersMetrics (OnOff False) _ = nullTracer tracePeerSelectionCountersMetrics (OnOff True) (Just ekgDirect) = pscTracer where pscTracer :: Tracer IO PeerSelectionCounters - pscTracer = Tracer $ \(PeerSelectionCounters cold warm hot coldBigLedgerPeers warmBigLedgerPeers hotBigLedgerPeers _) -> do - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.cold" cold - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.warm" warm - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.hot" hot - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.coldBigLedgerPeers" coldBigLedgerPeers - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.warmBigLedgerPeers" warmBigLedgerPeers - sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.hotBigLedgerPeers" hotBigLedgerPeers + pscTracer = Tracer $ \psc -> do + let PeerSelectionCountersHWC {..} = psc + -- Deprecated counters; they will be removed in a future version + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.cold" numberOfColdPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.warm" numberOfWarmPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.hot" numberOfHotPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.coldBigLedgerPeers" numberOfColdBigLedgerPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.warmBigLedgerPeers" numberOfWarmBigLedgerPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.hotBigLedgerPeers" numberOfHotBigLedgerPeers + + let PeerSelectionCounters {..} = psc + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.RootPeers" numberOfRootPeers + + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.KnownPeers" numberOfKnownPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ColdPeersPromotions" numberOfColdPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.EstablishedPeers" numberOfEstablishedPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmPeersDemotions" numberOfWarmPeersDemotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmPeersPromotions" numberOfWarmPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActivePeers" numberOfActivePeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActivePeersDemotions" numberOfActivePeersDemotions + + + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.KnownBigLedgerPeers" numberOfKnownBigLedgerPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ColdBigLedgerPeersPromotions" numberOfColdBigLedgerPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.EstablishedBigLedgerPeers" numberOfEstablishedBigLedgerPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmBigLedgerPeersDemotions" numberOfWarmBigLedgerPeersDemotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmBigLedgerPeersPromotions" numberOfWarmBigLedgerPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveBigLedgerPeers" numberOfActiveBigLedgerPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveBigLedgerPeersDemotions" numberOfActiveBigLedgerPeersDemotions + + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.KnownLocalRootPeers" numberOfKnownLocalRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.EstablishedLocalRootPeers" numberOfEstablishedLocalRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmLocalRootPeersPromotions" numberOfWarmLocalRootPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveLocalRootPeers" numberOfActiveLocalRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveLocalRootPeersDemotions" numberOfActiveLocalRootPeersDemotions + + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.KnownNonRootPeers" numberOfKnownNonRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ColdNonRootPeersPromotions" numberOfColdNonRootPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.EstablishedNonRootPeers" numberOfEstablishedNonRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmNonRootPeersDemotions" numberOfWarmNonRootPeersDemotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmNonRootPeersPromotions" numberOfWarmNonRootPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveNonRootPeers" numberOfActiveNonRootPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveNonRootPeersDemotions" numberOfActiveNonRootPeersDemotions + + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.KnownBootstrapPeers" numberOfKnownBootstrapPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ColdBootstrapPeersPromotions" numberOfColdBootstrapPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.EstablishedBootstrapPeers" numberOfEstablishedBootstrapPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmBootstrapPeersDemotions" numberOfWarmBootstrapPeersDemotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.WarmBootstrapPeersPromotions" numberOfWarmBootstrapPeersPromotions + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveBootstrapPeers" numberOfActiveBootstrapPeers + sendEKGDirectInt ekgDirect "cardano.node.metrics.peerSelection.ActiveBootstrapPeersDemotions" numberOfActiveBootstrapPeersDemotions + + +traceChurnCountersMetrics + :: Maybe EKGDirect + -> Tracer IO ChurnCounters +traceChurnCountersMetrics Nothing = nullTracer +traceChurnCountersMetrics (Just ekgDirect) = churnTracer + where + churnTracer :: Tracer IO ChurnCounters + churnTracer = Tracer $ \(ChurnCounter action c) -> + sendEKGDirectInt ekgDirect ("cardano.node.metrics.peerSelection.churn." <> Text.pack (show action)) c traceInboundGovernorCountersMetrics diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index c13ece99114..770b3120845 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -49,7 +49,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus-cardano - , ouroboros-network ^>= 0.14 + , ouroboros-network ^>= 0.15 , ouroboros-network-protocols , prometheus >= 2.2.4 , servant diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index e036e33c847..0f520ac4b5e 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -63,7 +63,7 @@ library , network , network-mux , optparse-applicative-fork - , ouroboros-network ^>= 0.14 + , ouroboros-network ^>= 0.15 , ouroboros-network-api , prettyprinter , process diff --git a/cardano-tracer/cardano-tracer.cabal b/cardano-tracer/cardano-tracer.cabal index d500c78d8bc..3433b28cf02 100644 --- a/cardano-tracer/cardano-tracer.cabal +++ b/cardano-tracer/cardano-tracer.cabal @@ -152,7 +152,7 @@ library , filepath , mime-mail , optparse-applicative - , ouroboros-network ^>= 0.14 + , ouroboros-network ^>= 0.15 , ouroboros-network-api , ouroboros-network-framework , signal diff --git a/flake.lock b/flake.lock index 1e72164db4a..e8be9beb496 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1712590917, - "narHash": "sha256-DgXSWHF5b/UtM+ACBWLPNtMNTSGQrmtl/ME7e7dheLo=", + "lastModified": 1715105614, + "narHash": "sha256-9zl3v82YkKXntzb6m14OfJG9c8YhKkmXYvHw1Sl4kqc=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "251738d00d5799850c6eb610c4ab7b175b66224a", + "rev": "7b1c2160379d3a0d1537ffb45d3163a5d98e6798", "type": "github" }, "original": { diff --git a/trace-dispatcher/trace-dispatcher.cabal b/trace-dispatcher/trace-dispatcher.cabal index 27ca7d3bad4..364925c48df 100644 --- a/trace-dispatcher/trace-dispatcher.cabal +++ b/trace-dispatcher/trace-dispatcher.cabal @@ -60,7 +60,7 @@ library , hostname , network , optparse-applicative-fork - , ouroboros-network ^>= 0.14 + , ouroboros-network ^>= 0.15 , ouroboros-network-api , ouroboros-network-framework , serialise From e7f5f3ac9e031b8ea12a16aee0bb37d94b5e1d11 Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Wed, 8 May 2024 15:26:51 +0200 Subject: [PATCH 08/10] outbound governor counters output for new tracing system --- .../src/Cardano/Node/Tracing/Tracers/P2P.hs | 99 +++++++++++-------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 4b536288e3f..1fb576a506f 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -869,48 +869,59 @@ instance MetaTrace (DebugPeerSelection SockAddr) where -------------------------------------------------------------------------------- instance LogFormatting PeerSelectionCounters where - forMachine _dtal PeerSelectionCounters {..} = - mconcat [ "kind" .= String "PeerSelectionCounters" - - , "knownPeers" .= numberOfKnownPeers - , "rootPeers" .= numberOfRootPeers - , "coldPeersPromotions" .= numberOfColdPeersPromotions - , "establishedPeers" .= numberOfEstablishedPeers - , "warmPeersDemotions" .= numberOfWarmPeersDemotions - , "warmPeersPromotions" .= numberOfWarmPeersPromotions - , "activePeers" .= numberOfActivePeers - , "activePeersDemotions" .= numberOfActivePeersDemotions - - , "knownBigLedgerPeers" .= numberOfKnownBigLedgerPeers - , "coldBigLedgerPeersPromotions" .= numberOfColdBigLedgerPeersPromotions - , "establishedBigLedgerPeers" .= numberOfEstablishedBigLedgerPeers - , "warmBigLedgerPeersDemotions" .= numberOfWarmBigLedgerPeersDemotions - , "warmBigLedgerPeersPromotions" .= numberOfWarmBigLedgerPeersPromotions - , "activeBigLedgerPeers" .= numberOfActiveBigLedgerPeers - , "activeBigLedgerPeersDemotions" .= numberOfActiveBigLedgerPeersDemotions - - , "knownLocalRootPeers" .= numberOfKnownLocalRootPeers - , "establishedLocalRootPeers" .= numberOfEstablishedLocalRootPeers - , "warmLocalRootPeersPromotions" .= numberOfWarmLocalRootPeersPromotions - , "activeLocalRootPeers" .= numberOfActiveLocalRootPeers - , "activeLocalRootPeersDemotions" .= numberOfActiveLocalRootPeersDemotions - - , "knownNonRootPeers" .= numberOfKnownNonRootPeers - , "coldNonRootPeersPromotions" .= numberOfColdNonRootPeersPromotions - , "establishedNonRootPeers" .= numberOfEstablishedNonRootPeers - , "warmNonRootPeersDemotions" .= numberOfWarmNonRootPeersDemotions - , "warmNonRootPeersPromotions" .= numberOfWarmNonRootPeersPromotions - , "activeNonRootPeers" .= numberOfActiveNonRootPeers - , "activeNonRootPeersDemotions" .= numberOfActiveNonRootPeersDemotions - - , "knownBootstrapPeers" .= numberOfKnownBootstrapPeers - , "coldBootstrapPeersPromotions" .= numberOfColdBootstrapPeersPromotions - , "establishedBootstrapPeers" .= numberOfEstablishedBootstrapPeers - , "warmBootstrapPeersDemotions" .= numberOfWarmBootstrapPeersDemotions - , "warmBootstrapPeersPromotions" .= numberOfWarmBootstrapPeersPromotions - , "activeBootstrapPeers" .= numberOfActiveBootstrapPeers - , "ActiveBootstrapPeersDemotions" .= numberOfActiveBootstrapPeersDemotions - ] + forMachine dtal PeerSelectionCounters {..} = + mconcat $ + [ "kind" .= String "PeerSelectionCounters" + + , "knownPeers" .= numberOfKnownPeers + , "rootPeers" .= numberOfRootPeers + , "establishedPeers" .= numberOfEstablishedPeers + , "activePeers" .= numberOfActivePeers + , "activePeersDemotions" .= numberOfActivePeersDemotions + + , "knownBigLedgerPeers" .= numberOfKnownBigLedgerPeers + , "establishedBigLedgerPeers" .= numberOfEstablishedBigLedgerPeers + , "activeBigLedgerPeers" .= numberOfActiveBigLedgerPeers + , "activeBigLedgerPeersDemotions" .= numberOfActiveBigLedgerPeersDemotions + + , "knownLocalRootPeers" .= numberOfKnownLocalRootPeers + , "establishedLocalRootPeers" .= numberOfEstablishedLocalRootPeers + , "activeLocalRootPeers" .= numberOfActiveLocalRootPeers + ] + <> + whenM (dtal > DMinimal) + [ "knownNonRootPeers" .= numberOfKnownNonRootPeers + , "establishedNonRootPeers" .= numberOfEstablishedNonRootPeers + , "activeNonRootPeers" .= numberOfActiveNonRootPeers + , "activeNonRootPeersDemotions" .= numberOfActiveNonRootPeersDemotions + + , "knownBootstrapPeers" .= numberOfKnownBootstrapPeers + , "establishedBootstrapPeers" .= numberOfEstablishedBootstrapPeers + , "activeBootstrapPeers" .= numberOfActiveBootstrapPeers + ] + <> + whenM (dtal > DNormal) + [ "coldPeersPromotions" .= numberOfColdPeersPromotions + , "warmPeersDemotions" .= numberOfWarmPeersDemotions + , "warmPeersPromotions" .= numberOfWarmPeersPromotions + + , "coldBigLedgerPeersPromotions" .= numberOfColdBigLedgerPeersPromotions + , "warmBigLedgerPeersDemotions" .= numberOfWarmBigLedgerPeersDemotions + , "warmBigLedgerPeersPromotions" .= numberOfWarmBigLedgerPeersPromotions + + , "warmLocalRootPeersPromotions" .= numberOfWarmLocalRootPeersPromotions + , "activeLocalRootPeersDemotions" .= numberOfActiveLocalRootPeersDemotions + + , "coldNonRootPeersPromotions" .= numberOfColdNonRootPeersPromotions + , "warmNonRootPeersDemotions" .= numberOfWarmNonRootPeersDemotions + , "warmNonRootPeersPromotions" .= numberOfWarmNonRootPeersPromotions + + , "coldBootstrapPeersPromotions" .= numberOfColdBootstrapPeersPromotions + , "warmBootstrapPeersDemotions" .= numberOfWarmBootstrapPeersDemotions + , "warmBootstrapPeersPromotions" .= numberOfWarmBootstrapPeersPromotions + + , "activeBootstrapPeersDemotions" .= numberOfActiveBootstrapPeersDemotions + ] forHuman = pack . show asMetrics psc = case psc of @@ -987,6 +998,10 @@ instance LogFormatting PeerSelectionCounters where , IntM "Net.PeerSelection.ActiveBootstrapPeersDemotions" (fromIntegral numberOfActiveBootstrapPeersDemotions) ] +whenM :: Monoid m => Bool -> m -> m +whenM False _ = mempty +whenM True m = m + instance MetaTrace PeerSelectionCounters where namespaceFor PeerSelectionCounters {} = Namespace [] ["Counters"] From e2ceaea4fbbf9742e51be3fbd9f0e9e84e463d15 Mon Sep 17 00:00:00 2001 From: Alexander Esgen Date: Thu, 27 Jun 2024 12:35:12 +0200 Subject: [PATCH 09/10] Release 8.9.4 --- cabal.project | 2 +- cardano-node/cardano-node.cabal | 6 +++--- flake.lock | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cabal.project b/cabal.project index 8199d0aaef7..949a30a1343 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-03-20T14:55:30Z - , cardano-haskell-packages 2024-05-07T17:27:07Z + , cardano-haskell-packages 2024-06-27T10:04:00Z packages: cardano-git-rev diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index c65a880182f..ff4098bd0ff 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node -version: 8.9.3 +version: 8.9.4 synopsis: The cardano full node description: The cardano full node. category: Cardano, @@ -183,8 +183,8 @@ library , network-mux >= 0.4 , nothunks , optparse-applicative-fork >= 0.18.1 - , ouroboros-consensus ^>= 0.16 - , ouroboros-consensus-cardano ^>= 0.14 + , ouroboros-consensus ^>= 0.16.1 + , ouroboros-consensus-cardano ^>= 0.14.3 , ouroboros-consensus-diffusion ^>= 0.14 , ouroboros-consensus-protocol , ouroboros-network-api ^>= 0.7 diff --git a/flake.lock b/flake.lock index e8be9beb496..41bd1e7a41d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1715105614, - "narHash": "sha256-9zl3v82YkKXntzb6m14OfJG9c8YhKkmXYvHw1Sl4kqc=", + "lastModified": 1719484563, + "narHash": "sha256-i7EuGE3ehUDR8Yz1sCiyfjoys4X8NEnf6og9GmapYdE=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "7b1c2160379d3a0d1537ffb45d3163a5d98e6798", + "rev": "bd06665c79ad35171837abdc3ce5495b2743e2ff", "type": "github" }, "original": { From 23a7146c9b091669c63fd2952765fdf25b30ba57 Mon Sep 17 00:00:00 2001 From: Alexander Esgen Date: Thu, 27 Jun 2024 13:09:14 +0200 Subject: [PATCH 10/10] locli: add `cardano-prelude < 0.2` constraint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise: src/Cardano/Analysis/API/Ground.hs:58:13: error: Ambiguous occurrence ‘toText’ It could refer to either ‘Cardano.Prelude.toText’, imported from ‘Cardano.Prelude’ at src/Cardano/Analysis/API/Ground.hs:14:1-53 (and originally defined in ‘cardano-prelude-0.2.0.0:Cardano.Prelude.ConvertText’) or ‘Data.Text.Short.toText’, imported from ‘Data.Text.Short’ at src/Cardano/Analysis/API/Ground.hs:25:63-68 (and originally defined in ‘text-short-0.1.5:Data.Text.Short.Internal’) | 58 | shortHash = toText . SText.take 6 . unHash | ^^^^^^ --- bench/locli/locli.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index 01e294640ec..895899eee10 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -103,7 +103,7 @@ library , bytestring , cardano-git-rev , cardano-ledger-core - , cardano-prelude + , cardano-prelude < 0.2 , cardano-slotting , containers , deepseq