Skip to content

Commit dbf6e86

Browse files
committed
imp: new tracing generic-log-config and cardanoLib updates
1 parent 209acbf commit dbf6e86

File tree

3 files changed

+353
-180
lines changed

3 files changed

+353
-180
lines changed

cardano-lib/default.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ let
8383
else legacyTopology;
8484

8585
defaultLogConfig = import ./generic-log-config.nix;
86+
defaultLogConfigLegacy = import ./generic-log-config-legacy.nix;
8687
defaultExplorerLogConfig = import ./explorer-log-config.nix;
8788

8889
mkExplorerConfig = name: nodeConfig: filterAttrs (k: v: v != null) {
@@ -133,7 +134,9 @@ let
133134
inherit name;
134135
# default derived configs:
135136
nodeConfig = defaultLogConfig // env.networkConfig;
137+
nodeConfigLegacy = defaultLogConfigLegacy // env.networkConfig;
136138
nodeConfigBp = defaultLogConfig // env.networkConfigBp;
139+
nodeConfigBpLegacy = defaultLogConfigLegacy // env.networkConfigBp;
137140
consensusProtocol = env.networkConfig.Protocol;
138141
submitApiConfig = mkSubmitApiConfig name environments.${name}.nodeConfig;
139142
dbSyncConfig =
@@ -311,6 +314,8 @@ let
311314
<div class="buttons has-addons">
312315
<a class="button is-primary" href="${env}-config.json">config</a>
313316
<a class="button is-primary" href="${env}-config-bp.json">block-producer config</a>
317+
<a class="button is-primary" href="${env}-config-legacy.json">config (legacy)</a>
318+
<a class="button is-primary" href="${env}-config-bp-legacy.json">block-producer config (legacy)</a>
314319
<a class="button is-info" href="${env}-${protNames.${p}.n}-genesis.json">${protNames.${p}.n}Genesis</a>
315320
${optionalString (p == "Cardano") ''
316321
<a class="button is-info" href="${env}-${protNames.${p}.shelley}-genesis.json">${protNames.${p}.shelley}Genesis</a>
@@ -362,9 +367,13 @@ let
362367
${if p != "Cardano" then ''
363368
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFile))} > $out/${env}-config.json
364369
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFile))} > $out/${env}-config-bp.json
370+
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFile))} > $out/${env}-config-legacy.json
371+
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFile))} > $out/${env}-config-bp-legacy.json
365372
'' else ''
366373
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFiles))} > $out/${env}-config.json
367374
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFiles))} > $out/${env}-config-bp.json
375+
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFiles))} > $out/${env}-config-legacy.json
376+
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFiles))} > $out/${env}-config-bp-legacy.json
368377
''}
369378
${optionalString (p == "RealPBFT" || p == "Byron") ''
370379
cp ${value.nodeConfig.GenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
@@ -377,7 +386,7 @@ let
377386
cp ${value.nodeConfig.ByronGenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
378387
cp ${value.nodeConfig.AlonzoGenesisFile} $out/${env}-${protNames.${p}.alonzo}-genesis.json
379388
''}
380-
${optionalString (p == "Cardano" && value.nodeConfig ? ConwayGenesisFile) ''
389+
${optionalString (p == "Cardano" && value.nodeConfigLegacy ? ConwayGenesisFile) ''
381390
cp ${value.nodeConfig.ConwayGenesisFile} $out/${env}-${protNames.${p}.conway}-genesis.json
382391
''}
383392
${jq}/bin/jq . < ${toFile "${env}-db-sync-config.json" (toJSON (value.dbSyncConfig // { NodeConfigFile = "${env}-config.json"; }))} > $out/${env}-db-sync-config.json
@@ -400,6 +409,7 @@ in {
400409
cardanoConfig
401410
defaultExplorerLogConfig
402411
defaultLogConfig
412+
defaultLogConfigLegacy
403413
eachEnv
404414
forEnvironments
405415
forEnvironmentsCustom
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
# Enable or disable logging overall
3+
TurnOnLogging = true;
4+
5+
# Enable the collection of various OS metrics such as memory and CPU use.
6+
# These metrics can be directed to the logs or monitoring backends.
7+
TurnOnLogMetrics = true;
8+
9+
# Global logging severity filter. Messages must have at least this severity to
10+
# pass. Typical values would be Warning, Notice, Info or Debug.
11+
minSeverity = "Info";
12+
13+
# Log items can be rendered with more or less verbose detail.
14+
# The verbosity can be: MinimalVerbosity, NormalVerbosity
15+
TracingVerbosity = "NormalVerbosity";
16+
17+
# Use legacy tracing
18+
UseTraceDispatcher = false;
19+
20+
# The system supports a number of backends for logging and monitoring.
21+
# This setting lists the the backends that will be available to use in the
22+
# configuration below. The logging backend is called Katip. Also enable the EKG
23+
# backend if you want to use the EKG or Prometheus monitoring interfaces.
24+
setupBackends = [
25+
"KatipBK"
26+
# EKGViewBK
27+
];
28+
29+
# This specifies the default backends that trace output is sent to if it
30+
# is not specifically configured to be sent to other backends.
31+
defaultBackends = [
32+
"KatipBK"
33+
];
34+
35+
# EKG is a simple metrics monitoring system. Uncomment the following to listen
36+
# on the given local port and point your web browser to http://localhost:12788/
37+
# for a live view. The same URL can also serve JSON output.
38+
hasEKG = 12788;
39+
40+
# The Prometheus monitoring system can also be used. Uncomment the following
41+
# to listen on the given port
42+
hasPrometheus = ["127.0.0.1" 12798];
43+
44+
# For the Katip logging backend we must set up outputs (called scribes)
45+
# The available types of scribe are:
46+
# FileSK for files
47+
# StdoutSK/StdoutSK for stdout/stderr
48+
# JournalSK for systemd's journal system
49+
# DevNullSK
50+
# The scribe output format can be ScText or ScJson. Log rotation settings can
51+
# be specified in the defaults below or overidden on a per-scribe basis here.
52+
setupScribes = [
53+
{
54+
scKind = "StdoutSK";
55+
scName = "stdout";
56+
scFormat = "ScText";
57+
scRotation = null;
58+
}
59+
];
60+
61+
# For the Katip logging backend this specifies the default scribes that trace
62+
# output is sent to if it is not configured to be sent to other scribes.
63+
defaultScribes = [
64+
[
65+
"StdoutSK"
66+
"stdout"
67+
]
68+
];
69+
70+
# The default file rotation settings for katip scribes, unless overridden
71+
# in the setupScribes above for specific scribes.
72+
rotation = {
73+
rpLogLimitBytes = 5000000;
74+
rpKeepFilesNum = 10;
75+
rpMaxAgeHours = 24;
76+
};
77+
78+
##### Coarse grained logging control #####
79+
80+
# Trace output from whole subsystems can be enabled/disabled using the following
81+
# settings. This provides fairly coarse grained control, but it is relatively
82+
# efficient at filtering out unwanted trace output.
83+
84+
# Trace BlockFetch client.
85+
TraceBlockFetchClient = false;
86+
87+
# Trace BlockFetch decisions made by the BlockFetch client.
88+
TraceBlockFetchDecisions = false;
89+
90+
# Trace BlockFetch protocol messages.
91+
TraceBlockFetchProtocol = false;
92+
93+
# Serialised Trace BlockFetch protocol messages.
94+
TraceBlockFetchProtocolSerialised = false;
95+
96+
# Trace BlockFetch server.
97+
TraceBlockFetchServer = false;
98+
99+
# Verbose tracer of ChainDB
100+
TraceChainDb = true;
101+
102+
# Trace ChainSync client.
103+
TraceChainSyncClient = false;
104+
105+
# Trace ChainSync server (blocks).
106+
TraceChainSyncBlockServer = false;
107+
108+
# Trace ChainSync server (headers)
109+
TraceChainSyncHeaderServer = false;
110+
111+
# Trace ChainSync protocol messages.
112+
TraceChainSyncProtocol = false;
113+
114+
# Trace connection manager
115+
TraceConnectionManager = true;
116+
117+
# Trace diffusion initialization messages
118+
TraceDiffusionInitialization = true;
119+
120+
# Trace DNS Resolver messages.
121+
TraceDNSResolver = true;
122+
123+
# Trace DNS Subscription messages.
124+
TraceDNSSubscription = true;
125+
126+
TraceAcceptPolicy = true;
127+
128+
# Trace error policy resolution.
129+
TraceErrorPolicy = true;
130+
131+
# Trace local error policy resolution.
132+
TraceLocalErrorPolicy = true;
133+
134+
# Trace block forging.
135+
TraceForge = true;
136+
137+
# Trace Handshake protocol messages.
138+
TraceHandshake = true;
139+
140+
TraceInboundGovernor = true;
141+
142+
# Trace IP Subscription messages.
143+
TraceIpSubscription = true;
144+
145+
# Trace ledger peers.
146+
TraceLedgerPeers = true;
147+
148+
# Trace local ChainSync protocol messages.
149+
TraceLocalChainSyncProtocol = false;
150+
151+
# Trace local Handshake protocol messages.
152+
TraceLocalHandshake = true;
153+
154+
# Trace local root peers
155+
TraceLocalRootPeers = true;
156+
157+
# Trace local TxSubmission protocol messages.
158+
TraceLocalTxSubmissionProtocol = false;
159+
160+
# Trace local TxSubmission server.
161+
TraceLocalTxSubmissionServer = false;
162+
163+
# Trace local Connection Manager.
164+
TraceLocalConnectionManager = true;
165+
166+
# Trace mempool.
167+
TraceMempool = true;
168+
169+
# Trace Mux Events
170+
TraceMux = false;
171+
172+
# Trace peer selection
173+
TracePeerSelection = true;
174+
175+
# Trace peer selection actions (demotion / protmotion between cold / warm and
176+
# hot peers).
177+
TracePeerSelectionActions = true;
178+
179+
# Trace public root peers
180+
TracePublicRootPeers = true;
181+
182+
# Trace server
183+
TraceServer = true;
184+
185+
# Trace TxSubmission server (inbound transactions).
186+
TraceTxInbound = false;
187+
188+
# Trace TxSubmission client (outbound transactions).
189+
TraceTxOutbound = false;
190+
191+
# Trace TxSubmission protocol messages.
192+
TraceTxSubmissionProtocol = false;
193+
194+
##### Fine grained logging control #####
195+
196+
# It is also possible to have more fine grained control over filtering of
197+
# trace output, and to match and route trace output to particular backends.
198+
# This is less efficient than the coarse trace filters above but provides
199+
# much more precise control.
200+
201+
options = {
202+
# This routes metrics matching specific names to particular backends.
203+
# This overrides the defaultBackends listed above. And note that it is
204+
# and override and not an extension so anything matched here will not
205+
# go to the default backend, only to the explicitly listed backends.
206+
mapBackends = {
207+
"cardano.node.metrics" = ["EKGViewBK"];
208+
"cardano.node.resources" = ["EKGViewBK"];
209+
};
210+
211+
# This section is more expressive still, and needs to be properly documented.
212+
mapSubtrace = {
213+
"cardano.node.metrics" = {
214+
subtrace = "Neutral";
215+
};
216+
};
217+
};
218+
}

0 commit comments

Comments
 (0)