Skip to content

Commit 5c0f136

Browse files
abaillyAnviking
authored andcommitted
Provide some documentation on tracer's logs and metrics
1 parent db96927 commit 5c0f136

File tree

1 file changed

+65
-3
lines changed

1 file changed

+65
-3
lines changed

compose/README.md

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Docker and `make` are the only requirement to build and run your own testnets.
7575

7676
### Local
7777

78-
- Build the `cardano-node`, `config` and `sidecar` container images
78+
- Build the `cardano-node`, `cardano-tracer`, `config` and `sidecar` container images
7979

8080
```
8181
make build testnet=example_10.2.1
@@ -86,14 +86,15 @@ Docker and `make` are the only requirement to build and run your own testnets.
8686
8787
### Antithesis
8888

89-
- Build the `cardano-node`, `config` and `sidecar` container images for the Antithesis container registry
89+
- Build the `cardano-node`, `cardano-tracer`, `config` and `sidecar` container images for the Antithesis container registry
9090

9191
```
9292
make build testnet=example_10.2.1 registry=us-central1-docker.pkg.dev/molten-verve-216720/cardano-repository/
9393
```
9494

9595
> [!IMPORTANT]
9696
> Always supply the registry argument when building for Antithesis.
97+
> It's not necessary to log into the registry for building, but it is necessary for running antithesis tests.
9798
9899
## Run
99100

@@ -191,7 +192,7 @@ Docker and `make` are the only requirement to build and run your own testnets.
191192
cat credentials.json | docker login -u _json_key https://us-central1-docker.pkg.dev --password-stdin
192193
```
193194

194-
- Push the `cardano-node`, `config` and `sidecar` container images
195+
- Push the `cardano-node`, `cardano-tracer`, `config` and `sidecar` container images
195196

196197
```
197198
make push testnet=example_10.2.1 registry=us-central1-docker.pkg.dev/molten-verve-216720/cardano-repository/
@@ -230,6 +231,67 @@ Docker and `make` are the only requirement to build and run your own testnets.
230231
> [!TIP]
231232
> The commands above assume a testnet of 3 pools, increase the `{1..3}` if needed.
232233
234+
### Logging & Metrics
235+
236+
The `tracer` container which runs alongside the Cardano cluster aggregates logs and metrics for each of the running nodes. The details of the configuration are out of scope for this document, please checkout the [cardano-tracer](https://github.com/IntersectMBO/cardano-node/tree/master/cardano-tracer) and [new tracing system](https://developers.cardano.org/docs/get-started/cardano-node/new-tracing-system/new-tracing-system) documentation. The default example configuration aggregates some interesting logs and expose Prometheus metrics on port 4000.
237+
238+
- Query prometheus metrics (each node has its own path for metrics):
239+
240+
```bash
241+
curl -s http://localhost:4000/p1example-3001 | grep block
242+
```
243+
244+
```
245+
# TYPE cardano_node_metrics_served_block_latest_int gauge
246+
cardano_node_metrics_served_block_latest_int 4
247+
# TYPE cardano_node_metrics_blockfetchclient_blocksize_int gauge
248+
cardano_node_metrics_blockfetchclient_blocksize_int 862
249+
# TYPE cardano_node_metrics_blocksForged_int gauge
250+
cardano_node_metrics_blocksForged_int 2
251+
cardano_node_metrics_blockfetchclient_blockdelay_real 4.574799e-3
252+
# TYPE cardano_node_metrics_blockNum_int gauge
253+
cardano_node_metrics_blockNum_int 4
254+
# TYPE cardano_node_metrics_served_block_counter counter
255+
cardano_node_metrics_served_block_counter 4
256+
```
257+
258+
- List available logs (logs from each node are dumped into a file on a shared volume, the name of the file contains timestamp):
259+
260+
```bash
261+
docker exec -ti tracer ls -l /opt/cardano-tracer
262+
```
263+
264+
```
265+
drwxr-xr-x 2 cardano cardano 4096 Apr 13 07:42 p1.example_3001
266+
drwxr-xr-x 2 cardano cardano 4096 Apr 13 07:42 p2.example_3001
267+
drwxr-xr-x 2 cardano cardano 4096 Apr 13 07:42 p3.example_3001
268+
srwxr-xr-x 1 cardano cardano 0 Apr 13 07:42 tracer.socket
269+
```
270+
271+
```bash
272+
for i in {1..3}; do docker exec -ti tracer ls -l /opt/cardano-tracer/p${i}.example_3001/ ; done
273+
```
274+
275+
```
276+
total 404
277+
-rw-r--r-- 1 cardano cardano 411911 Apr 13 07:49 node-2025-04-13T07-42-11.json
278+
total 376
279+
-rw-r--r-- 1 cardano cardano 379328 Apr 13 07:49 node-2025-04-13T07-42-11.json
280+
total 380
281+
-rw-r--r-- 1 cardano cardano 384804 Apr 13 07:49 node-2025-04-13T07-42-10.json
282+
```
283+
284+
- Follow logs from a specific node:
285+
286+
```
287+
$ docker exec -ti tracer tail -f /opt/cardano-tracer/p2.example_3001/node-2025-04-13T07-42-11.json
288+
{"at":"2025-04-13T07:47:57.001449232Z","ns":["Forge","Loop","NodeNotLeader"],"data":{"kind":"TraceNodeNotLeader","slot":417},"sev":"Info","thread":"41","host":"p2.example"}
289+
{"at":"2025-04-13T07:47:58.001200722Z","ns":["Forge","Loop","StartLeadershipCheckPlus"],"data":{"chainDensity":3.7974683544303798610197731022708467207849025726318359375e-2,"delegMapSize":3,"kind":"TraceStartLeadershipCheck","slot":418,"utxoSize":3},"sev":"Info","thread":"41","host":"p2.example"}
290+
{"at":"2025-04-13T07:47:58.001427133Z","ns":["Forge","StateInfo","StateInfo"],"data":{"credentials":"Cardano","endPeriod":0,"evolution":62,"kind":"KESInfo","startPeriod":0},"sev":"Info","thread":"41","host":"p2.example"}
291+
{"at":"2025-04-13T07:47:58.001722819Z","ns":["Forge","Loop","NodeNotLeader"],"data":{"kind":"TraceNodeNotLeader","slot":418},"sev":"Info","thread":"41","host":"p2.example"}
292+
...
293+
```
294+
233295
## Appendix
234296

235297
- [Antithesis Documentation](https://antithesis.com/docs/)

0 commit comments

Comments
 (0)