From 45cfac3aae02e60765ee2c7afddbc6367fb78f40 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 11 Nov 2024 17:02:50 +0100 Subject: [PATCH 1/7] wb | genesis: post-process cache entries after retrieval --- nix/workbench/genesis/genesis.sh | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/nix/workbench/genesis/genesis.sh b/nix/workbench/genesis/genesis.sh index f1cb530fda2..7c42cf9f860 100644 --- a/nix/workbench/genesis/genesis.sh +++ b/nix/workbench/genesis/genesis.sh @@ -251,16 +251,60 @@ case "$op" in return fi - progress "genesis" "deriving from cache: $cache_entry -> $outdir" + progress "genesis" "finalizing retrieved cache entry in: $outdir" local system_start_epoch system_start_epoch="$(jq '.start' -r <<<"$timing")" genesis-byron "$system_start_epoch" "$dir" "$profile_json" - jq '. * { systemStart: $timing.systemStart }' --argjson timing "$timing" \ + # The genesis cache entry in $outdir needs post-processing: + # * the system start date might get an adjustment offset into the future + # * some workbench profile content not captured by the genesis cache key will be patched in + + # For devs: this should cover all fields modified by + # * nix/workbench/profile/pparams/delta-*.jq (workbench) + # * bench/cardano-profile/data/genesis/overlays/*.json (cardano-profile) + # These modifications are small deltas to base profiles, which do not, and should + # not, result in recreation of the entire staked genesis, as that is large on-disk + # and takes long to create. + + # Shelley: startTime, protocolVersion, maxBlockBodySize + jq '$prof[0].genesis.shelley as $shey + | $shey.protocolParams.protocolVersion as $pver + | $shey.protocolParams.maxBlockBodySize as $bsize + | . * { systemStart: $timing.systemStart } + | if $pver != null then . * { protocolParams: { protocolVersion: $pver } } else . end + | if $bsize != null then . * { protocolParams: { maxBlockBodySize: $bsize } } else . end' \ + --argjson timing "$timing" \ + --slurpfile prof "$profile_json" \ "$dir"/genesis-shelley.json | sponge "$dir"/genesis-shelley.json + + # Alonzo: Execution budgets + # NB. PlutusV1 and PlutusV2 cost models are *NOT* covered here; they're encoded + # as key-value-map in the profile, but need to be [Integer] in genesis. + jq '$prof[0].genesis.alonzo as $alzo + | $alzo.maxBlockExUnits.exUnitsMem as $bl_mem + | $alzo.maxBlockExUnits.exUnitsSteps as $bl_steps + | $alzo.maxTxExUnits.exUnitsMem as $tx_mem + | $alzo.maxTxExUnits.exUnitsSteps as $tx_steps + | if $bl_mem != null then . * { maxBlockExUnits: { memory: $bl_mem} } else . end + | if $bl_steps != null then . * { maxBlockExUnits: { steps: $bl_steps} } else . end + | if $tx_mem != null then . * { maxTxExUnits: { memory: $tx_mem} } else . end + | if $tx_steps != null then . * { maxTxExUnits: { steps: $tx_steps} } else . end' \ + --slurpfile prof "$profile_json" \ + "$dir"/genesis.alonzo.json | + sponge "$dir"/genesis.alonzo.json + + # Conway: plutusV3CostModel + jq '$prof[0].genesis.conway as $coay + | $coay.plutusV3CostModel as $pv3cost + | if $pv3cost != null then . * { plutusV3CostModel: $pv3cost } else . end' \ + --slurpfile prof "$profile_json" \ + "$dir"/genesis.conway.json | + sponge "$dir"/genesis.conway.json + ;; * ) From fcf51b1567ad21b5dffca4ddf2244c2997413604 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 18 Nov 2024 19:04:31 +0100 Subject: [PATCH 2/7] tracing: fix Mempool.Synced; add metricsDocs --- .../src/Cardano/Node/Tracing/Tracers/Consensus.hs | 9 ++++----- nix/workbench/service/tracing.nix | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs index 8eefe8dc5cc..38d8b141c6d 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs @@ -1311,7 +1311,7 @@ instance MetaTrace (TraceEventMempool blk) where severityFor (Namespace _ ["RejectedTx"]) _ = Just Info severityFor (Namespace _ ["RemoveTxs"]) _ = Just Info severityFor (Namespace _ ["ManuallyRemovedTxs"]) _ = Just Info - severityFor (Namespace _ ["Synced"]) _ = Just Info + severityFor (Namespace _ ["Synced"]) _ = Just Debug severityFor _ _ = Nothing metricsDocFor (Namespace _ ["AddedTx"]) = @@ -1331,11 +1331,9 @@ instance MetaTrace (TraceEventMempool blk) where , ("mempoolBytes", "Byte size of the mempool") , ("txsProcessedNum", "") ] - metricsDocFor (Namespace _ ["Synced"]) = [ ("txsSyncDuration", "Time to sync the mempool in ms after block adoption") ] - metricsDocFor _ = [] documentFor (Namespace _ ["AddedTx"]) = Just @@ -1358,6 +1356,7 @@ instance MetaTrace (TraceEventMempool blk) where , Namespace [] ["RejectedTx"] , Namespace [] ["RemoveTxs"] , Namespace [] ["ManuallyRemovedTxs"] + , Namespace [] ["Synced"] ] -------------------------------------------------------------------------------- @@ -1417,8 +1416,8 @@ instance MetaTrace (ForgeTracerType blk) where privacyFor _ _ = Nothing metricsDocFor (Namespace _ ["StartLeadershipCheckPlus"]) = - [ ("Forge.UtxoSize", "") - , ("Forge.DelegMapSize", "") + [ ("Forge.UtxoSize", "UTxO set size") + , ("Forge.DelegMapSize", "Delegation map size") ] metricsDocFor ns = metricsDocFor (nsCast ns :: Namespace (TraceForgeEvent blk)) diff --git a/nix/workbench/service/tracing.nix b/nix/workbench/service/tracing.nix index 9b8ef772d6e..60060e1b4e4 100644 --- a/nix/workbench/service/tracing.nix +++ b/nix/workbench/service/tracing.nix @@ -47,6 +47,7 @@ let "Forge.Loop".severity = "Debug"; "Forge.StateInfo".severity = "Debug"; "Mempool".severity = "Debug"; + "Mempool.Synced".severity = "Silence"; "Net".severity = "Notice"; "Net.AcceptPolicy".severity = "Debug"; "Net.ConnectionManager.Local".severity = "Debug"; From 3ffcb0fb5f6ff32a12a943c3f102549bc01224b3 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 18 Nov 2024 19:07:02 +0100 Subject: [PATCH 3/7] scripts: let P2P bind to address; fix new tracing config --- .../cardano/mainnet-config-new-tracing.json | 94 ++++++++++++++++++- scripts/lite/mainnet-new-tracing.sh | 3 +- scripts/lite/mainnet.sh | 2 +- 3 files changed, 94 insertions(+), 5 deletions(-) diff --git a/configuration/cardano/mainnet-config-new-tracing.json b/configuration/cardano/mainnet-config-new-tracing.json index eef33cdbf8a..ee731016f3b 100644 --- a/configuration/cardano/mainnet-config-new-tracing.json +++ b/configuration/cardano/mainnet-config-new-tracing.json @@ -3,18 +3,106 @@ "AlonzoGenesisHash": "7e94a15f55d1e82d10f09203fa1d40f8eede58fd8066542cf6566008068ed874", "ByronGenesisFile": "mainnet-byron-genesis.json", "ByronGenesisHash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb", + "ConwayGenesisFile": "mainnet-conway-genesis.json", + "ConwayGenesisHash": "15a199f895e461ec0ffc6dd4e4028af28a492ab4e806d39cb674c88f7643ef62", + "EnableP2P": true, "LastKnownBlockVersion-Alt": 0, "LastKnownBlockVersion-Major": 3, "LastKnownBlockVersion-Minor": 0, "MaxKnownMajorProtocolVersion": 2, + "PeerSharing": true, "Protocol": "Cardano", "RequiresNetworkMagic": "RequiresNoMagic", "ShelleyGenesisFile": "mainnet-shelley-genesis.json", "ShelleyGenesisHash": "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81", "TurnOnLogging": true, + "TurnOnLogMetrics": true, "UseTraceDispatcher": true, + "TraceOptionForwarder": null, + "TraceOptionMetricsPrefix": null, + "TraceOptionNodeName": null, "TraceOptionPeerFrequency": 3000, - "TraceOptionResourceFrequency": 4000, - "TurnOnLogMetrics": true, - "TraceOptions": {} + "TraceOptionResourceFrequency": 5000, + "TraceOptions": { + "": { + "backends": [ + "Stdout HumanFormatColoured", + "EKGBackend", + "Forwarder" + ], + "severity": "Notice" + }, + "BlockFetch.Decision": { + "severity": "Silence" + }, + "ChainDB": { + "severity": "Info" + }, + "ChainDB.AddBlockEvent.AddBlockValidation": { + "severity": "Silence" + }, + "ChainSync.Client": { + "severity": "Info" + }, + "Net.ConnectionManager.Remote": { + "severity": "Info" + }, + "Net.Subscription.DNS": { + "severity": "Info" + }, + "Startup.DiffusionInit": { + "severity": "Info" + }, + "Net.ErrorPolicy": { + "severity": "Info" + }, + "Forge.Loop": { + "severity": "Info" + }, + "Forge.StateInfo": { + "severity": "Info" + }, + "Net.InboundGovernor.Remote": { + "severity": "Info" + }, + "Net.Subscription.IP": { + "severity": "Info" + }, + "Net.ErrorPolicy.Local": { + "severity": "Info" + }, + "Mempool": { + "severity": "Info" + }, + "Mempool.Synced": { + "severity": "Silence" + }, + "Net.Mux.Remote": { + "severity": "Info" + }, + "Net.PeerSelection": { + "severity": "Info" + }, + "Resources": { + "severity": "Info" + }, + "ChainDB.AddBlockEvent.AddedBlockToQueue": { + "maxFrequency": 2.0 + }, + "ChainDB.AddBlockEvent.AddedBlockToVolatileDB": { + "maxFrequency": 2.0 + }, + "ChainDB.AddBlockEvent.AddBlockValidation.ValidCandidate": { + "maxFrequency": 2.0 + }, + "ChainDB.CopyToImmutableDBEvent.CopiedBlockToImmutableDB": { + "maxFrequency": 2.0 + }, + "ChainSync.Client.DownloadedHeader": { + "maxFrequency": 2.0 + }, + "BlockFetch.Client.CompletedBlockFetch": { + "maxFrequency": 2.0 + } + } } diff --git a/scripts/lite/mainnet-new-tracing.sh b/scripts/lite/mainnet-new-tracing.sh index 45a00d716cc..edf95dcb429 100755 --- a/scripts/lite/mainnet-new-tracing.sh +++ b/scripts/lite/mainnet-new-tracing.sh @@ -18,7 +18,8 @@ cabal run exe:cardano-node -- run \ --topology "${configuration}/mainnet-topology.json" \ --database-path "${db_dir}" \ --socket-path "${socket_dir}/node-1-socket" \ - --host-addr "127.0.0.1" \ + --tracer-socket-path-connect "${socket_dir}/tracer.socket" \ + --host-addr "0.0.0.0" \ --port "3001" diff --git a/scripts/lite/mainnet.sh b/scripts/lite/mainnet.sh index db763757cd7..ef93f734b55 100755 --- a/scripts/lite/mainnet.sh +++ b/scripts/lite/mainnet.sh @@ -18,7 +18,7 @@ cabal run exe:cardano-node -- run \ --topology "${configuration}/mainnet-topology.json" \ --database-path "${db_dir}" \ --socket-path "${socket_dir}/node-1-socket" \ - --host-addr "127.0.0.1" \ + --host-addr "0.0.0.0" \ --port "3001" From 2d07a6029564815b949c1f2f333d5ddd45510866 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 19 Nov 2024 15:18:14 +0100 Subject: [PATCH 4/7] locli: discern RIPEMD-160 in reports; cleanup --- bench/locli/CHANGELOG.md | 8 ++++ bench/locli/locli.cabal | 24 ++---------- .../locli/src/Cardano/Analysis/API/Ground.hs | 37 +++++-------------- bench/locli/src/Cardano/Report.hs | 4 ++ 4 files changed, 26 insertions(+), 47 deletions(-) create mode 100644 bench/locli/CHANGELOG.md diff --git a/bench/locli/CHANGELOG.md b/bench/locli/CHANGELOG.md new file mode 100644 index 00000000000..7b5339b4dba --- /dev/null +++ b/bench/locli/CHANGELOG.md @@ -0,0 +1,8 @@ +# Revision history for locli + +## 1.36 -- Nov 2024 + +* Add `CHANGELOG.md` for `locli` +* Discern Plutus RIPEMD-160 workload in reports +* Remove unused build-depends + diff --git a/bench/locli/locli.cabal b/bench/locli/locli.cabal index e5f1bd3b52d..ba55c43f405 100644 --- a/bench/locli/locli.cabal +++ b/bench/locli/locli.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: locli -version: 1.35 +version: 1.36 synopsis: Cardano log analysis CLI description: Cardano log analysis CLI. category: Cardano, @@ -12,6 +12,7 @@ maintainer: operations@iohk.io license: Apache-2.0 license-files: LICENSE NOTICE +extra-doc-files: CHANGELOG.md build-type: Simple common project-config @@ -95,11 +96,8 @@ library autogen-modules: Paths_locli build-depends: aeson - , Histogram , aeson-pretty , async - , attoparsec - , attoparsec-iso8601 , bytestring , cardano-git-rev ^>= 0.2.2 , cardano-ledger-core @@ -110,27 +108,16 @@ library , directory , ede , extra - , file-embed , filepath , fingertree , hashable - , gnuplot - , iohk-monitoring - , optparse-applicative-fork - , optparse-generic + , optparse-applicative-fork >= 0.18.1 , ouroboros-consensus - -- for Data.SOP.Strict: - , ouroboros-network ^>= 0.17 - , ouroboros-network-api - , process - , quiet - , scientific + , ouroboros-network-api ^>= 0.10 , sop-core , split , statistics , strict-sop-core - , system-filepath - , template-haskell , text , text-short , time @@ -139,10 +126,8 @@ library , transformers-except , unix , unordered-containers - , utf8-string , vector , witherable - , cardano-strict-containers ^>= 0.1 executable locli import: project-config @@ -150,7 +135,6 @@ executable locli hs-source-dirs: app main-is: locli.hs ghc-options: -threaded - -Wall -rtsopts "-with-rtsopts=-T -N7 -A2m -qb -H64m" diff --git a/bench/locli/src/Cardano/Analysis/API/Ground.hs b/bench/locli/src/Cardano/Analysis/API/Ground.hs index d09abe5bf6d..005108b4946 100644 --- a/bench/locli/src/Cardano/Analysis/API/Ground.hs +++ b/bench/locli/src/Cardano/Analysis/API/Ground.hs @@ -10,14 +10,12 @@ module Cardano.Analysis.API.Ground ) where -import Prelude (show) +import Prelude as P (show) import Cardano.Prelude hiding (head, toText) import Unsafe.Coerce qualified as Unsafe import Data.Aeson import Data.Aeson.Types (toJSONKeyText) -import Data.Attoparsec.Text qualified as Atto -import Data.Attoparsec.Time qualified as Iso8601 import Data.ByteString.Lazy.Char8 qualified as LBS import Data.Map.Strict qualified as Map import Data.Text qualified as T @@ -26,7 +24,6 @@ import Data.Text.Short (ShortText, fromText, toText) import Data.Time.Clock (UTCTime, NominalDiffTime) import Options.Applicative import Options.Applicative qualified as Opt -import Quiet (Quiet (..)) import System.FilePath qualified as F import Cardano.Slotting.Slot (EpochNo(..), SlotNo(..)) @@ -41,13 +38,17 @@ newtype FieldName = FieldName { unFieldName :: Text } deriving (Eq, Generic, Ord) deriving newtype (FromJSON, IsString, ToJSON) deriving anyclass NFData - deriving Show via Quiet FieldName + +instance Show FieldName where + show = ("FieldName " ++) . P.show . unFieldName newtype TId = TId { unTId :: ShortText } deriving (Eq, Generic, Ord) deriving newtype (FromJSON, ToJSON) deriving anyclass NFData - deriving Show via Quiet TId + +instance Show TId where + show = ("TId " ++) . P.show . unTId newtype Hash = Hash { unHash :: ShortText } deriving (Eq, Generic, Ord) @@ -95,7 +96,9 @@ newtype Host = Host { unHost :: ShortText } deriving (Eq, Generic, Ord) deriving newtype (IsString, FromJSON, ToJSON) deriving anyclass NFData - deriving Show via Quiet Host + +instance Show Host where + show = ("Host " ++) . P.show . unHost newtype EpochSlot = EpochSlot { unEpochSlot :: Word64 } deriving stock (Eq, Generic, Ord, Show) @@ -269,26 +272,6 @@ pSlotNo name desc = <> Opt.help desc ) -optUTCTime :: String -> String -> Parser UTCTime -optUTCTime optname desc = - Opt.option (readerFromAttoParser Iso8601.utcTime) - $ long optname - <> metavar "ISO8601-TIME" - <> help desc - where - -- Stolen from: cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs - readerFromAttoParser :: Atto.Parser a -> Opt.ReadM a - readerFromAttoParser p = - Opt.eitherReader (Atto.parseOnly (p <* Atto.endOfInput) . T.pack) - -optDuration :: String -> String -> NominalDiffTime -> Parser NominalDiffTime -optDuration optname desc def= - Opt.option ((realToFrac :: Double -> NominalDiffTime) <$> Opt.auto) - $ long optname - <> metavar "SEC" - <> help desc - <> value def - optWord :: String -> String -> Word64 -> Parser Word64 optWord optname desc def = Opt.option auto diff --git a/bench/locli/src/Cardano/Report.hs b/bench/locli/src/Cardano/Report.hs index 16fc89e3c5f..de03da69b25 100644 --- a/bench/locli/src/Cardano/Report.hs +++ b/bench/locli/src/Cardano/Report.hs @@ -80,6 +80,7 @@ data Workload | WPlutusLoopCountdown | WPlutusLoopSECP | WPlutusLoopBLST + | WPlutusLoopRipemd | WPlutusUnknown instance ToJSON Workload where @@ -88,6 +89,7 @@ instance ToJSON Workload where WPlutusLoopCountdown -> "Plutus countdown loop" WPlutusLoopSECP -> "Plutus SECP loop" WPlutusLoopBLST -> "Plutus BLST loop" + WPlutusLoopRipemd -> "Plutus RIPEMD-160 loop" WPlutusUnknown -> "Plutus (other)" filenameInfix :: Workload -> Text @@ -95,6 +97,7 @@ filenameInfix = \case WPlutusLoopCountdown -> "plutus" WPlutusLoopSECP -> "plutus-secp" WPlutusLoopBLST -> "plutus-blst" + WPlutusLoopRipemd -> "plutus-ripemd" WValue -> "value-only" _ -> "unknown" @@ -150,6 +153,7 @@ liftTmplRun Summary{sumWorkload=generatorProfile | script == "EcdsaSecp256k1Loop" -> WPlutusLoopSECP | script == "SchnorrSecp256k1Loop" -> WPlutusLoopSECP | script == "HashOntoG2AndAdd" -> WPlutusLoopBLST + | script == "Ripemd160" -> WPlutusLoopRipemd | otherwise -> WPlutusUnknown } From e739eea65e0c38004478a6d372cfd85c2f946008 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 19 Nov 2024 18:35:26 +0100 Subject: [PATCH 5/7] wb | tracing: correct describe-run; explicit NodeName in config --- nix/workbench/backend/supervisor.sh | 27 +++++++++++++++++---------- nix/workbench/env.sh | 9 +++++---- nix/workbench/service/tracing.nix | 5 +++++ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/nix/workbench/backend/supervisor.sh b/nix/workbench/backend/supervisor.sh index cdfe5bc049d..c9e08301140 100755 --- a/nix/workbench/backend/supervisor.sh +++ b/nix/workbench/backend/supervisor.sh @@ -97,16 +97,23 @@ case "$op" in local usage="USAGE: wb backend $op RUN-DIR" local dir=${1:?$usage} - local basePort=$( envjq 'basePort') - local port_ekg=$(( basePort+$(envjq 'port_shift_ekg'))) - local port_prometheus=$((basePort+$(envjq 'port_shift_prometheus'))) - local port_rtview=$(( basePort+$(envjq 'port_shift_rtview'))) - - cat <&2 diff --git a/nix/workbench/env.sh b/nix/workbench/env.sh index b47964e64b3..7f7b2bcb59b 100644 --- a/nix/workbench/env.sh +++ b/nix/workbench/env.sh @@ -1,8 +1,9 @@ WB_ENV_DEFAULT=' -{ "type": "supervisor" -, "cacheDir": "'${XDG_CACHE_HOME:-$HOME/.cache}'/cardano-workbench" -, "basePort": 30000 -, "staggerPorts": true +{ "type": "supervisor" +, "cacheDir": "'${XDG_CACHE_HOME:-$HOME/.cache}'/cardano-workbench" +, "basePort": 30000 +, "basePortTracer": 3000 +, "staggerPorts": true }' export WB_ENV=$WB_ENV_DEFAULT diff --git a/nix/workbench/service/tracing.nix b/nix/workbench/service/tracing.nix index 60060e1b4e4..b98d3e9d73a 100644 --- a/nix/workbench/service/tracing.nix +++ b/nix/workbench/service/tracing.nix @@ -13,6 +13,7 @@ let { UseTraceDispatcher = true; TraceOptionResourceFrequency = 1000; + TraceOptionNodeName = nodeSpec.name; ## Please see the generated tracing configuration reference at: ## @@ -130,6 +131,10 @@ let TraceBlockFetchServer = true; TraceChainSyncHeaderServer = true; TraceChainSyncClient = true; + + ## needs to be explicit when new tracing is the node's default + UseTraceDispatcher = false; + options = { mapBackends = { "cardano.node.resources" = [ "KatipBK" ]; From 17db405321590d81d1d93d91d5730f59ec0052bb Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Thu, 21 Nov 2024 16:58:23 +0000 Subject: [PATCH 6/7] wb | healthcheck conway enabled --- nix/workbench/service/healthcheck.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/workbench/service/healthcheck.nix b/nix/workbench/service/healthcheck.nix index 76a967f63e1..54e396039c6 100644 --- a/nix/workbench/service/healthcheck.nix +++ b/nix/workbench/service/healthcheck.nix @@ -355,8 +355,8 @@ let else local tip block slot # Returns nothing/empty/"" when the node is exiting - tip=$(${cardano-cli}/bin/cardano-cli query tip \ - --testnet-magic "''${network_magic}" \ + tip=$(${cardano-cli}/bin/cardano-cli conway query tip \ + --testnet-magic "''${network_magic}" \ --socket-path "../''${node}/node.socket" ) block=$(${coreutils}/bin/echo "''${tip}" | ${jq}/bin/jq .block) From 186f0e7bee368d7567f7e2e7175f60d01ce077a8 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Thu, 21 Nov 2024 18:08:40 +0100 Subject: [PATCH 7/7] locli: remove several unused or redundant attributes and commands --- bench/locli/CHANGELOG.md | 5 +- .../locli/src/Cardano/Analysis/API/Metrics.hs | 20 +------ bench/locli/src/Cardano/Analysis/API/Types.hs | 1 - bench/locli/src/Cardano/Analysis/Summary.hs | 6 +- bench/locli/src/Cardano/Command.hs | 34 +++-------- bench/locli/src/Cardano/Unlog/LogObject.hs | 5 -- nix/workbench/analyse/analyse.sh | 58 ++----------------- 7 files changed, 21 insertions(+), 108 deletions(-) diff --git a/bench/locli/CHANGELOG.md b/bench/locli/CHANGELOG.md index 7b5339b4dba..6bfaea32800 100644 --- a/bench/locli/CHANGELOG.md +++ b/bench/locli/CHANGELOG.md @@ -5,4 +5,7 @@ * Add `CHANGELOG.md` for `locli` * Discern Plutus RIPEMD-160 workload in reports * Remove unused build-depends - +* Remove redundant fields from summary report: Perf analysis start/stop spread, Log text lines per host (NB. incompatible for comparison with `summary.org` files created with prior versions) +* Remove unused CLI commands `list-logobject-keys-legacy` and `list-logobject-keys` +* Remove unused `HostLogs` SHA256 checksums +* Disable missing trace detection (temporarily), as raw data isn't properly evaluated to that end at the moment diff --git a/bench/locli/src/Cardano/Analysis/API/Metrics.hs b/bench/locli/src/Cardano/Analysis/API/Metrics.hs index 3a6ad4c3ec0..7a186926535 100644 --- a/bench/locli/src/Cardano/Analysis/API/Metrics.hs +++ b/bench/locli/src/Cardano/Analysis/API/Metrics.hs @@ -48,11 +48,10 @@ sumFieldsReport = , "plutusScript" , "sumHosts", "sumLogObjectsTotal" , "sumFilters" - , "cdfLogLinesEmitted", "cdfLogObjectsEmitted", "cdfLogObjects" + , "cdfLogObjectsEmitted", "cdfLogObjects" , "cdfRuntime", "cdfLogLineRate" , "ddRawCount.sumDomainTime", "ddFilteredCount.sumDomainTime", "dataDomainFilterRatio.sumDomainTime" , "ddRaw.sumStartSpread", "ddRaw.sumStopSpread" - , "ddFiltered.sumStartSpread", "ddFiltered.sumStopSpread" , "sumDomainSlots", "sumDomainBlocks", "sumBlocksRejected"] instance (KnownCDF f) => TimelineFields (Summary f) where @@ -95,8 +94,8 @@ instance (KnownCDF f) => TimelineFields (Summary f) where "" <> fScalar "utxo" W12 Cnt (IWord64 $ utxo.sumGenesisSpec) - "Starting UTxO set size" - "Extra UTxO set size at the beginning of the benchmark" + "Stuffed UTxO size" + "Extra UTxO set entries (from genesis)" <> fScalar "dreps" W12 Cnt (IWord64 $ dreps.sumGenesisSpec) "DRep count" @@ -136,10 +135,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where "Number of filters applied" "" - <> fScalar "cdfLogLinesEmitted" W12 Cnt (IFloat $ cdfAverageVal.cdfLogLinesEmitted) - "Log text lines emitted per host" - "" - <> fScalar "cdfLogObjectsEmitted" W12 Cnt (IFloat $ cdfAverageVal.cdfLogObjectsEmitted) "Log objects emitted per host" "" @@ -180,14 +175,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where "Node stop spread, s" "" - <> fScalar "ddFiltered.sumStartSpread" W9 Sec (IDeltaT$ maybe 0 (intvDurationSec.fmap (fromRUTCTime . arityProj cdfMedian)).ddFiltered.sumStartSpread) - "Perf analysis start spread, s" - "" - - <> fScalar "ddFiltered.sumStopSpread" W9 Sec (IDeltaT$ maybe 0 (intvDurationSec.fmap (fromRUTCTime . arityProj cdfMedian)).ddFiltered.sumStopSpread) - "Perf analysis stop spread, s" - "" - <> fScalar "sumDomainSlots" W12 Slo (IInt $ floor.arityProj cdfMedian.cdfAverage.ddFilteredCount.sumDomainSlots) "Slots analysed" "" @@ -211,7 +198,6 @@ instance (KnownCDF f) => TimelineFields (Summary f) where , manifestPackages <&> pkgCommit ] - -- fieldJSONOverlay f = (:[]) . tryOverlayFieldDescription f propSubsetFn :: PropSubset -> (Field DSelect p a -> Bool) diff --git a/bench/locli/src/Cardano/Analysis/API/Types.hs b/bench/locli/src/Cardano/Analysis/API/Types.hs index 5cbcf31ea9c..9f8331b3cfa 100644 --- a/bench/locli/src/Cardano/Analysis/API/Types.hs +++ b/bench/locli/src/Cardano/Analysis/API/Types.hs @@ -50,7 +50,6 @@ data Summary f where , sumDomainBlocks :: !(DataDomain f BlockNo) , sumProfilingData :: !(Maybe (ProfilingData (CDF I))) - , cdfLogLinesEmitted :: !(CDF f Int) , cdfLogObjectsEmitted :: !(CDF f Int) , cdfLogObjects :: !(CDF f Int) , cdfRuntime :: !(CDF f NominalDiffTime) diff --git a/bench/locli/src/Cardano/Analysis/Summary.hs b/bench/locli/src/Cardano/Analysis/Summary.hs index 23d30813f24..7994c08e2d6 100644 --- a/bench/locli/src/Cardano/Analysis/Summary.hs +++ b/bench/locli/src/Cardano/Analysis/Summary.hs @@ -71,7 +71,6 @@ summariseMultiSummary sumAnalysisTime centiles xs@(headline:xss) = do sumMeta <- summariseMetadata $ xs <&> sumMeta sumFilters <- allEqOrElse (xs <&> sumFilters) SEIncoherentRunFilters - cdfLogLinesEmitted <- sumCDF2 $ xs <&> cdfLogLinesEmitted cdfLogObjectsEmitted <- sumCDF2 $ xs <&> cdfLogObjectsEmitted cdfLogObjects <- sumCDF2 $ xs <&> cdfLogObjects cdfRuntime <- sumCDF2 $ xs <&> cdfRuntime @@ -172,7 +171,6 @@ computeSummary sumAnalysisTime -- , cdfLogObjects = cdf stdCentiles (objLists <&> length) , cdfLogObjectsEmitted = cdf stdCentiles logObjectsEmitted - , cdfLogLinesEmitted = cdf stdCentiles textLinesEmitted , cdfRuntime = cdf stdCentiles runtimes , .. } @@ -183,7 +181,7 @@ computeSummary sumAnalysisTime rlHostLogs & Map.elems - (,) logObjectsEmitted textLinesEmitted = + (logObjectsEmitted, textLinesEmitted) = hostLogs & fmap (hlRawLogObjects &&& hlRawLines) & unzip @@ -198,7 +196,7 @@ computeSummary sumAnalysisTime lineRates = zipWith (/) (textLinesEmitted <&> fromIntegral) (runtimes <&> fromIntegral @Int . truncate) - (,,) sumDomainTime sumStartSpread sumStopSpread = + (sumDomainTime, sumStartSpread, sumStopSpread) = slotDomains sumGenesis (losFirsts, losLasts) mpDomainSlots sumChainRejectionStats :: [(ChainFilter, Int)] diff --git a/bench/locli/src/Cardano/Command.hs b/bench/locli/src/Cardano/Command.hs index 41d3738477e..21a5a539152 100644 --- a/bench/locli/src/Cardano/Command.hs +++ b/bench/locli/src/Cardano/Command.hs @@ -47,10 +47,7 @@ newtype Command deriving Show data ChainCommand - = ListLogobjectKeys TextOutputFile - | ListLogobjectKeysLegacy TextOutputFile - - | ReadMetaGenesis (JsonInputFile RunPartial) (JsonInputFile Genesis) + = ReadMetaGenesis (JsonInputFile RunPartial) (JsonInputFile Genesis) | WriteMetaGenesis TextOutputFile TextOutputFile | Unlog (JsonInputFile (RunLogs ())) Bool (Maybe [LOAnyType]) @@ -104,12 +101,6 @@ data ChainCommand parseChainCommand :: Parser ChainCommand parseChainCommand = subparser (mconcat [ commandGroup "Common data: logobject keys, run metafile & genesis" - , op "list-logobject-keys" "List logobject keys that analyses care about" - (ListLogobjectKeys - <$> optTextOutputFile "keys" "Text file to write logobject keys to") - , op "list-logobject-keys-legacy" "List legacy logobject keys that analyses care about" - (ListLogobjectKeysLegacy - <$> optTextOutputFile "keys-legacy" "Text file to write logobject keys to") , op "read-meta-genesis" "Read the run metadata: meta.json and Shelley genesis" (ReadMetaGenesis <$> optJsonInputFile "run-metafile" "The meta.json file from the benchmark run" @@ -391,22 +382,9 @@ sAnchor State{sTags=[]} = error "sAnchor with no run or multi-summary." sAnchor s@State{sTags} = stateAnchor sTags s -quote :: T.Text -> T.Text -quote = (<> "\"") . ("\"" <>) runChainCommand :: State -> ChainCommand -> ExceptT CommandError IO State -runChainCommand s - c@(ListLogobjectKeys f) = do - dumpText "logobject-keys" (quote . toText <$> logObjectStreamInterpreterKeys) f - & firstExceptT (CommandError c) - pure s -runChainCommand s - c@(ListLogobjectKeysLegacy f) = do - dumpText "logobject-keys-legacy" (quote . toText <$> logObjectStreamInterpreterKeysLegacy) f - & firstExceptT (CommandError c) - pure s - runChainCommand s c@(ReadMetaGenesis runMeta shelleyGenesis) = do progress "run" (Q $ printf "reading run metadata & Shelley genesis") @@ -601,7 +579,7 @@ runChainCommand s@State{sRun=Just _run, sSlots=Just slots} runChainCommand _ c@TimelineSlots{} = missingCommandData c ["run metadata & genesis", "filtered slots"] -runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}, sRunLogs} +runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}} c@ComputePropagation = do progress "block-propagation" $ J (cDomBlocks, cDomSlots) prop <- pure (blockProp run chain) @@ -615,9 +593,11 @@ runChainCommand s@State{sRun=Just run, sChain=Just chain@Chain{..}, sRunLogs} renderBlockPropError e <> maybe "" ((".\n\n Missing traces in run logs (not all are fatal):\n\n " <>) . T.intercalate "\n " - . fmap toText - . rlMissingTraces) - sRunLogs + . const [] + ) + Nothing + -- TODO: reactivate output once there's a proper evaluation of raw data + runChainCommand _ c@ComputePropagation = missingCommandData c ["run metadata & genesis", "chain", "data domains for slots & blocks"] diff --git a/bench/locli/src/Cardano/Unlog/LogObject.hs b/bench/locli/src/Cardano/Unlog/LogObject.hs index aebfbc7bba9..8702e1e8f2f 100644 --- a/bench/locli/src/Cardano/Unlog/LogObject.hs +++ b/bench/locli/src/Cardano/Unlog/LogObject.hs @@ -87,11 +87,8 @@ data HostLogs a = HostLogs { hlRawLogfiles :: [FilePath] , hlRawLines :: Int - , hlRawSha256 :: Hash , hlRawTraceFreqs :: Map Text Int - , hlMissingTraces :: [Text] , hlLogs :: (JsonLogfile, a) - , hlFilteredSha256 :: Hash , hlProfile :: [ProfileEntry I] , hlRawFirstAt :: Maybe UTCTime , hlRawLastAt :: Maybe UTCTime @@ -107,8 +104,6 @@ hlRawLogObjects = sum . Map.elems . hlRawTraceFreqs data RunLogs a = RunLogs { rlHostLogs :: Map.Map Host (HostLogs a) - , rlMissingTraces :: [Text] - , rlFilterKeys :: [Text] , rlFilterDate :: UTCTime } deriving (Generic, FromJSON, ToJSON) diff --git a/nix/workbench/analyse/analyse.sh b/nix/workbench/analyse/analyse.sh index ea362b358cf..56e2350503f 100644 --- a/nix/workbench/analyse/analyse.sh +++ b/nix/workbench/analyse/analyse.sh @@ -556,18 +556,7 @@ EOF local adir=$dir/analysis mkdir -p "$adir"/{cdf,png} - ## 0. ask locli what it cares about - local keyfile="$adir"/substring-keys - local key_old=$(sha256sum 2>/dev/null "$keyfile" | cut -d' ' -f1) - local tracing_backend=$(jq '.node.tracing_backend // "iohk-monitoring"' --raw-output $dir/profile.json) - case "$tracing_backend" in - trace-dispatcher ) locli 'list-logobject-keys' --keys "$keyfile";; - iohk-monitoring ) locli 'list-logobject-keys-legacy' --keys-legacy "$keyfile";; - * ) fail "Unknown tracing backend: $tracing_backend" - esac - local key_new=$(sha256sum "$keyfile" | cut -d' ' -f1) - - ## 1. unless already done, filter logs according to locli's requirements + ## unless already done, filter logs to contain trace objects only local logdirs=($(ls -d "$dir"/node-*/ 2>/dev/null)) local run_logs=$adir/log-manifest.json @@ -599,27 +588,18 @@ EOF local out="$adir"/logs-$mach cat ${logfiles[*]} | grep '^{' > "$out".flt.json & trace_frequencies_json ${logfiles[*]} > "$out".tracefreq.json & - { cat ${logfiles[*]} | - sha256sum | - cut -d' ' -f1 | - xargs echo -n - } > "$out".sha256 & - jq_fmutate "$run_logs" ' .rlHostLogs["'"$mach"'"] = { hlRawLogfiles: ["'"$(echo ${logfiles[*]} | sed 's/ /", "/')"'"] , hlRawLines: '"$(cat ${logfiles[*]} | wc -l)"' - , hlRawSha256: "" , hlRawTraceFreqs: {} , hlLogs: ["'"$adir/logs-$mach.flt.json"'", null] - , hlFilteredSha256: "" , hlProfile: [] } | .rlFilterDate = ('$(if test -z "$without_datever_meta" then echo -n now else echo -n 0; fi)' | todate) - | .rlFilterKeys = [] ' local ghc_rts_prof=$d/cardano-node.prof @@ -647,21 +627,10 @@ EOF progress "analyse" "log manifest updating for consolidated logs" for mach in $(jq_tolist '.rlHostLogs | keys' $run_logs) do jq_fmutate "$run_logs" ' - .rlHostLogs[$mach].hlRawSha256 = $raw_sha256 - | .rlHostLogs[$mach].hlRawTraceFreqs = $freqs[0] - - | ($freqs[0] | keys | map (split(":"))) as $keypairs - | .rlHostLogs[$mach].hlMissingTraces = - (($keys | split("\n")) - - ($keypairs | map (.[0])) # new tracing namespace entries - - ($keypairs | map (.[1])) # old tracing .kinds - - ["", "unknown0", "unknown1"] - | unique) + .rlHostLogs[$mach].hlRawTraceFreqs = $freqs[0] ' --sort-keys \ - --arg mach $mach \ - --rawfile raw_sha256 "$adir"/logs-$mach.sha256 \ - --slurpfile freqs "$adir"/logs-$mach.tracefreq.json \ - --rawfile keys $keyfile + --arg mach $mach \ + --slurpfile freqs "$adir"/logs-$mach.tracefreq.json done local ht_json=$adir/hash-timeline.json @@ -669,24 +638,7 @@ EOF then progress "analyse" "hash timeline up to date" else progress "analyse" "building hash timeline" grep -h 'TraceForgedBlock\|DownloadedHeader' $adir/logs-*.flt.json | sort > $ht_json - - # skip checksumming consolidated logs for now, to facilitate fast truncation of long runs - #for mach in $(jq_tolist '.rlHostLogs | keys' $run_logs) - #do jq_fmutate "$run_logs" ' - # .rlHostLogs[$mach].hlFilteredSha256 = $filtered_sha256 - # ' --arg mach $mach \ - # --arg filtered_sha256 $(sha256sum < $adir/logs-$mach.flt.json | \ - # cut -d' ' -f1 | xargs echo -n) - #done - fi - - jq_fmutate "$run_logs" ' - .rlMissingTraces = - ( .rlHostLogs - | map(.hlMissingTraces) - | add - | unique - )';; + fi;; trace-frequencies | trace-freq | freq | tf ) local new_only= sargs=()