Skip to content

Commit 649f6a3

Browse files
authored
Merge pull request #6480 from IntersectMBO/bench-master
bench: maintenance
2 parents 55e4aeb + 4f4fc7a commit 649f6a3

7 files changed

Lines changed: 43 additions & 36 deletions

File tree

bench/locli/src/Cardano/Unlog/BackendDB.hs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Cardano.Unlog.BackendDB
1717
) where
1818

1919
import Cardano.Analysis.API.Ground (Host (..), LogObjectSource (..))
20-
import Cardano.Prelude (ExceptT)
20+
import Cardano.Prelude (ExceptT, (<|>))
2121
import Cardano.Unlog.LogObject (HostLogs (..), LogObject (..), RunLogs (..), fromTextRef)
2222
import Cardano.Unlog.LogObjectDB
2323
import Cardano.Util (sequenceConcurrentlyChunksOf, withTimingInfo)
@@ -35,6 +35,7 @@ import qualified Data.Map.Strict as Map
3535
import Data.Maybe
3636
import qualified Data.Text.Short as ShortText (unpack)
3737
import Data.Time.Clock (UTCTime, getCurrentTime)
38+
import Data.Time.Format.ISO8601
3839
import GHC.Conc (numCapabilities)
3940
import System.Directory (removeFile)
4041

@@ -147,15 +148,23 @@ tMinMax [] = fail "tMinMax: empty list of log files"
147148
tMinMax [log] = do
148149
ls2 <- BSL.lines <$> BSL.readFile log
149150
let
150-
loMin, loMax :: LogObject
151+
loMin :: LogObject
152+
loMax :: UTCTime
151153
loMin = head $ mapMaybe Aeson.decode ls2
152-
loMax = fromJust (Aeson.decode $ last ls2)
153-
pure (loAt loMin, loAt loMax)
154+
loMax = fromJust $ (loAt <$> Aeson.decode (last ls2)) <|> parseTimeStampFromPartial (last ls2)
155+
pure (loAt loMin, loMax)
154156
tMinMax logs = do
155157
(tMin, _ ) <- tMinMax [head logs]
156158
(_ , tMax) <- tMinMax [last logs]
157159
pure (tMin, tMax)
158160

161+
-- extracts timestamp from the last log line even if incomplete (due to node shutdown) - sample data:
162+
-- {"at":"2026-03-25T16:19:47.482228445Z","ns":"...",...
163+
parseTimeStampFromPartial :: BSL.ByteString -> Maybe UTCTime
164+
parseTimeStampFromPartial partial =
165+
formatParseM iso8601Format $ BSL.unpack ts
166+
where ts = BSL.takeWhile (/= '"') . BSL.drop 7 $ partial
167+
159168

160169
-- selects the entire LogObject stream, containing all objects relevant for standard analysis
161170
selectAll :: SQL

bench/tx-generator/src/Cardano/Benchmarking/Tracer.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,15 @@ configSilent :: ConfigOption
182182
configSilent = ConfSeverity (SeverityF Nothing)
183183

184184
initialTraceConfig :: TraceConfig
185-
initialTraceConfig = TraceConfig {
186-
tcOptions = Map.fromList
185+
initialTraceConfig = emptyTraceConfig
186+
{ tcOptions = Map.fromList
187187
[ ([], [configSilent])
188188
, setMaxDetail TracerNameBench
189189
, ([TracerNameSubmitN2N], [configSilent])
190190
, setMaxDetail TracerNameConnect
191191
, setMaxDetail TracerNameSubmit
192192
]
193193
, tcForwarder = Just defaultForwarder {tofQueueSize = 4096}
194-
, tcNodeName = Nothing
195-
, tcResourceFrequency = Nothing
196-
, tcMetricsPrefix = Nothing
197-
, tcLedgerMetricsFrequency = Nothing
198194
}
199195
where
200196
setMaxDetail :: Text -> ([Text], [ConfigOption])

cardano-node/src/Cardano/Node/Tracing/DefaultTraceConfig.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ defaultCardanoConfig = emptyTraceConfig {
3232
[ ConfSeverity (SeverityF (Just Warning))])
3333
,(["Net", "ConnectionManager", "Remote"],
3434
[ ConfSeverity (SeverityF (Just Info))])
35-
,(["Net", "Subscription", "DNS"],
36-
[ ConfSeverity (SeverityF (Just Info))])
3735
,(["Startup", "DiffusionInit"],
3836
[ ConfSeverity (SeverityF (Just Info))])
3937
,(["Net", "ErrorPolicy"],
@@ -44,10 +42,6 @@ defaultCardanoConfig = emptyTraceConfig {
4442
[ ConfSeverity (SeverityF (Just Info))])
4543
,(["Net", "InboundGovernor", "Remote"],
4644
[ ConfSeverity (SeverityF (Just Info))])
47-
,(["Net", "Subscription", "IP"],
48-
[ ConfSeverity (SeverityF (Just Info))])
49-
,(["Net", "ErrorPolicy", "Local"],
50-
[ ConfSeverity (SeverityF (Just Info))])
5145
,(["Mempool"],
5246
[ ConfSeverity (SeverityF (Just Info))])
5347
,(["Net", "Mux", "Remote"],

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import Ouroboros.Network.Point (withOrigin)
1919
import Control.Concurrent.MVar
2020
import Data.Aeson (Value (String), (.=))
2121
import Data.Text (pack)
22+
import Numeric (showFFloat)
23+
2224

2325
newtype ReplayBlockState = ReplayBlockState
2426
{ -- | Last slot for which a `ReplayBlockStats` message has been issued.
@@ -63,7 +65,7 @@ instance LogFormatting ReplayBlockStats where
6365
<> " out of "
6466
<> textShow (unSlotNo rpsGoalSlot)
6567
<> ". Progress: "
66-
<> textShow (progressForHuman stats)
68+
<> pack (showFFloat (Just 2) (progressForHuman stats) mempty)
6769
<> "%"
6870

6971
asMetrics stats =

cardano-tracer/src/Cardano/Tracer/MetaTrace.hs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,8 @@ configTracerTracer defSeverity tr = do
292292
configureTracers configReflection initialTraceConfig [tr]
293293
where
294294
initialTraceConfig :: TraceConfig
295-
initialTraceConfig =
296-
TraceConfig
297-
{ tcForwarder = Nothing
298-
, tcNodeName = Nothing
299-
, tcResourceFrequency = Nothing
300-
, tcLedgerMetricsFrequency = Nothing
301-
, tcMetricsPrefix = Nothing
302-
, tcOptions = Map.fromList
295+
initialTraceConfig = emptyTraceConfig
296+
{ tcOptions = Map.fromList
303297
[ ([], [ConfSeverity defSeverity])
304298
, (["Tracer"], [ConfDetail DMaximum])
305299
]

nix/workbench/service/tracing.nix

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ with lib;
99
let
1010
trace-dispatcher =
1111
recursiveUpdate
12-
(removeLegacyTracingOptions cfg)
12+
(removeAttrs (removeLegacyTracingOptions cfg) ["TraceOptionForwarder"])
1313
{
1414
UseTraceDispatcher = true;
1515
TraceOptionResourceFrequency = 1000;
1616
TraceOptionNodeName = nodeSpec.name;
1717

18+
## Set this value to cover our log line rate (~70Hz) on typical bench machines (not the apex hardware).
19+
## It should avoid seeing "TraceObject queue overflowed. Dropped xxx messages ..." on a bench node's stderr.
20+
TraceOptionForwarder = {
21+
queueSize = 192;
22+
};
23+
1824
## Please see the generated tracing configuration reference at:
1925
##
2026
## https://github.com/intersectmbo/cardano-node/blob/master/doc/new-tracing/tracers_doc_generated.md#trace-messages
@@ -38,7 +44,7 @@ let
3844
"BlockFetch.Server".severity = "Debug";
3945
"BlockchainTime".severity = "Notice";
4046
"ChainDB".severity = "Debug";
41-
"ChainDB.LedgerEvent.Flavor.V1.OnDisk.BackingStoreEvent".severity = "Silence";
47+
"ChainDB.LedgerEvent.Flavor.V1.".severity = "Silence";
4248
"ChainDB.LedgerEvent.Flavor.V2".severity = "Silence";
4349
"ChainDB.ReplayBlock.LedgerReplay".severity = "Notice";
4450
"ChainSync.Client".severity = "Debug";
@@ -57,11 +63,11 @@ let
5763
"Net.ConnectionManager.Local".severity = "Debug";
5864
"Net.ConnectionManager.Remote".severity = "Debug";
5965
"Net.DNSResolver".severity = "Notice";
60-
"Net.ErrorPolicy.Local".severity = "Debug";
61-
"Net.ErrorPolicy.Remote".severity = "Debug";
66+
"Net.ErrorPolicy".severity = "Debug";
6267
"Net.Handshake.Local".severity = "Debug";
6368
"Net.Handshake.Remote".severity = "Debug";
6469
"Net.InboundGovernor.Local".severity = "Debug";
70+
"Net.InboundGovernor.Local.RemoteState".severity = "Info";
6571
"Net.InboundGovernor.Remote".severity = "Debug";
6672
"Net.InboundGovernor.Transition".severity = "Debug";
6773
"Net.Mux.Local".severity = "Notice";
@@ -73,13 +79,10 @@ let
7379
"Net.PeerSelection.Responder".severity = "Notice";
7480
"Net.PeerSelection.Selection".severity = "Debug";
7581
"Net.Peers.Ledger".severity = "Debug";
76-
"Net.Peers.List".severity = "Notice";
7782
"Net.Peers.LocalRoot".severity = "Debug";
7883
"Net.Peers.PublicRoot".severity = "Debug";
7984
"Net.Server.Local".severity = "Debug";
8085
"Net.Server.Remote".severity = "Debug";
81-
"Net.Subscription.DNS".severity = "Debug";
82-
"Net.Subscription.IP".severity = "Debug";
8386
"NodeState".severity = "Notice";
8487
"LedgerMetrics".severity = "Info";
8588
"Resources".severity = "Debug";

shell.nix

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,37 @@ let
181181

182182
haveGlibcLocales = pkgs.glibcLocales != null && stdenv.hostPlatform.libc == "glibc";
183183

184+
workbench = import ./nix/workbench/default.nix
185+
{ inherit pkgs; haskellProject = project; }
186+
;
187+
184188
workbench-shell =
185189
with customConfig.localCluster;
186190
import ./nix/workbench/shell.nix
187191
{ inherit pkgs lib haskellLib project;
188192
inherit setLocale haveGlibcLocales;
189193
inherit workbenchDevMode;
190194
inherit withHoogle;
191-
workbench-runner = pkgs.workbench-runner
195+
workbench-runner = workbench.runner
192196
{ inherit profiling;
193-
inherit profileName backendName useCabalRun;
197+
inherit profileName backendName;
198+
inherit useCabalRun;
199+
inherit workbenchStartArgs cardano-node-rev;
200+
inherit (customConfig.localCluster) stateDir basePort batchName;
194201
};
195202
};
196203

197204
devops =
198205
let profileName = "devops-bage";
199-
workbench-runner = pkgs.workbench-runner
206+
workbench-runner = workbench.runner
200207
{ inherit profiling;
201208
inherit profileName;
202209
backendName = "supervisor";
203210
useCabalRun = false;
211+
inherit workbenchStartArgs cardano-node-rev;
212+
inherit (customConfig.localCluster) stateDir basePort batchName;
204213
};
205-
devopsShell = with customConfig.localCluster;
214+
devopsShell =
206215
import ./nix/workbench/shell.nix
207216
{ inherit pkgs lib haskellLib project;
208217
inherit setLocale haveGlibcLocales;

0 commit comments

Comments
 (0)