Skip to content

Commit 4751f3b

Browse files
committed
wip: new tracing
1 parent ea26f2c commit 4751f3b

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
@@ -74,6 +74,7 @@ let
7474
else legacyTopology;
7575

7676
defaultLogConfig = import ./generic-log-config.nix;
77+
defaultLogConfigLegacy = import ./generic-log-config-legacy.nix;
7778
defaultExplorerLogConfig = import ./explorer-log-config.nix;
7879

7980
mkExplorerConfig = name: nodeConfig: filterAttrs (k: v: v != null) {
@@ -122,7 +123,9 @@ let
122123
inherit name;
123124
# default derived configs:
124125
nodeConfig = defaultLogConfig // env.networkConfig;
126+
nodeConfigLegacy = defaultLogConfigLegacy // env.networkConfig;
125127
nodeConfigBp = defaultLogConfig // env.networkConfigBp;
128+
nodeConfigBpLegacy = defaultLogConfigLegacy // env.networkConfigBp;
126129
consensusProtocol = env.networkConfig.Protocol;
127130
submitApiConfig = mkSubmitApiConfig name environments.${name}.nodeConfig;
128131
dbSyncConfig =
@@ -297,6 +300,8 @@ let
297300
<div class="buttons has-addons">
298301
<a class="button is-primary" href="${env}-config.json">config</a>
299302
<a class="button is-primary" href="${env}-config-bp.json">block-producer config</a>
303+
<a class="button is-primary" href="${env}-config-legacy.json">config (legacy)</a>
304+
<a class="button is-primary" href="${env}-config-bp-legacy.json">block-producer config (legacy)</a>
300305
<a class="button is-info" href="${env}-${protNames.${p}.n}-genesis.json">${protNames.${p}.n}Genesis</a>
301306
${optionalString (p == "Cardano") ''
302307
<a class="button is-info" href="${env}-${protNames.${p}.shelley}-genesis.json">${protNames.${p}.shelley}Genesis</a>
@@ -343,9 +348,13 @@ let
343348
${if p != "Cardano" then ''
344349
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFile))} > $out/${env}-config.json
345350
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFile))} > $out/${env}-config-bp.json
351+
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFile))} > $out/${env}-config-legacy.json
352+
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFile))} > $out/${env}-config-bp-legacy.json
346353
'' else ''
347354
${jq}/bin/jq . < ${toFile "${env}-config.json" (toJSON (value.nodeConfig // genesisFiles))} > $out/${env}-config.json
348355
${jq}/bin/jq . < ${toFile "${env}-config-bp.json" (toJSON (value.nodeConfigBp // genesisFiles))} > $out/${env}-config-bp.json
356+
${jq}/bin/jq . < ${toFile "${env}-config-legacy.json" (toJSON (value.nodeConfigLegacy // genesisFiles))} > $out/${env}-config-legacy.json
357+
${jq}/bin/jq . < ${toFile "${env}-config-bp-legacy.json" (toJSON (value.nodeConfigBpLegacy // genesisFiles))} > $out/${env}-config-bp-legacy.json
349358
''}
350359
${optionalString (p == "RealPBFT" || p == "Byron") ''
351360
cp ${value.nodeConfig.GenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
@@ -358,7 +367,7 @@ let
358367
cp ${value.nodeConfig.ByronGenesisFile} $out/${env}-${protNames.${p}.n}-genesis.json
359368
cp ${value.nodeConfig.AlonzoGenesisFile} $out/${env}-${protNames.${p}.alonzo}-genesis.json
360369
''}
361-
${optionalString (p == "Cardano" && value.nodeConfig ? ConwayGenesisFile) ''
370+
${optionalString (p == "Cardano" && value.nodeConfigLegacy ? ConwayGenesisFile) ''
362371
cp ${value.nodeConfig.ConwayGenesisFile} $out/${env}-${protNames.${p}.conway}-genesis.json
363372
''}
364373
${jq}/bin/jq . < ${toFile "${env}-db-sync-config.json" (toJSON (value.dbSyncConfig // { NodeConfigFile = "${env}-config.json"; }))} > $out/${env}-db-sync-config.json
@@ -377,6 +386,7 @@ in {
377386
cardanoConfig
378387
defaultExplorerLogConfig
379388
defaultLogConfig
389+
defaultLogConfigLegacy
380390
eachEnv
381391
forEnvironments
382392
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)