Skip to content

Commit f346ad6

Browse files
committed
cardano-tracer: update docs
1 parent b9120e3 commit f346ad6

File tree

3 files changed

+91
-40
lines changed

3 files changed

+91
-40
lines changed

cardano-tracer/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# ChangeLog
22

3-
## 0.3 (September 20, 2024)
3+
## 0.3 (September 26, 2024)
44

55
* Abondon `snap` webserver in favour of `wai`/`warp` for Prometheus and EKG Monitoring.
66
* Add dynamic routing to EKG stores of all connected nodes.
77
* Derive URL compliant routes from connected node names (instead of plain node names).
88
* Remove the requirement of two distinct ports for the EKG backend (changing `hasEKG` config type).
9+
* Improved OpenMetrics compliance of Prometheus exposition; also addresses [issue#5140][i5140].
10+
* Prometheus help annotations can be provided via the new optional config value `metricsHelp`.
911
* For optional RTView component only: Disable SSL/https connections. Force `snap-server`
1012
dependency to build with `-flag -openssl`.
1113
* Add JSON responses when listing connected nodes for both Prometheus and EKG Monitoring.
14+
* Fix: actually send `forHuman` rendering output to journald when specified.
1215
* Add consistency check for redundant port values in the config.
1316

1417
## 0.2.4 (August 13, 2024)
@@ -48,3 +51,7 @@
4851
## 0.1.0
4952

5053
Initial version.
54+
55+
56+
57+
[i5140]: https://github.com/IntersectMBO/cardano-node/issues/5140

cardano-tracer/docs/cardano-tracer.md

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44

55
# Contents
66

7-
1. [Introduction](#Introduction)
8-
1. [Motivation](#Motivation)
9-
3. [Overview](#Overview)
10-
2. [Build and run](#Build-and-run)
11-
3. [Configuration](#Configuration)
12-
1. [Distributed Scenario](#Distributed-scenario)
13-
2. [Local Scenario](#Local-scenario)
14-
3. [Network Magic](#Network-magic)
15-
4. [Requests](#Requests)
16-
5. [Logging](#Logging)
17-
6. [Logs Rotation](#Logs-rotation)
18-
7. [Prometheus](#Prometheus)
19-
8. [EKG Monitoring](#EKG-monitoring)
20-
9. [Verbosity](#Verbosity)
21-
10. [RTView](#RTView)
7+
- [Cardano Tracer](#cardano-tracer)
8+
- [Contents](#contents)
9+
- [Introduction](#introduction)
10+
- [Motivation](#motivation)
11+
- [Overview](#overview)
12+
- [Build and run](#build-and-run)
13+
- [Configuration](#configuration)
14+
- [Distributed Scenario](#distributed-scenario)
15+
- [Important](#important)
16+
- [Local Scenario](#local-scenario)
17+
- [Network Magic](#network-magic)
18+
- [Requests](#requests)
19+
- [Logging](#logging)
20+
- [Logs Rotation](#logs-rotation)
21+
- [Prometheus](#prometheus)
22+
- [EKG Monitoring](#ekg-monitoring)
23+
- [Verbosity](#verbosity)
24+
- [RTView](#rtview)
2225

2326
# Introduction
2427

@@ -390,20 +393,51 @@ $ curl --silent -H "Accept: application/json" '127.0.0.1:3200' | jq '.'
390393
}
391394
```
392395

393-
The Promethus output is a map from Prometheus metric to value:
396+
Prometheus uses the text-based exposition format, complete with `# TYPE` and `# HELP` annotations. The latter ones have to be provided by the `metricsHelp` config value (see below).
397+
398+
The output should be [OpenMetrics](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#text-format) compliant. Example snippet:
394399

395400
```
396401
$ curl '127.0.0.1:3200/12700130004'
397-
blockNum_int 35
398-
rts_gc_init_cpu_ms 5
399-
rts_gc_par_tot_bytes_copied 0
400-
served_block_counter 31
401-
submissions_accepted_counter 2771
402-
density_real 5.7692307692307696e-2
403-
blocksForged_int 6
404-
402+
# TYPE Mem_resident_int gauge
403+
# HELP Mem_resident_int Kernel-reported RSS (resident set size)
404+
Mem_resident_int 103792640
405+
# TYPE rts_gc_max_bytes_used gauge
406+
rts_gc_max_bytes_used 5811512
407+
# TYPE rts_gc_gc_cpu_ms counter
408+
rts_gc_gc_cpu_ms 50
409+
# TYPE RTS_gcMajorNum_int gauge
410+
# HELP RTS_gcMajorNum_int Major GCs
411+
RTS_gcMajorNum_int 4
412+
# TYPE rts_gc_par_avg_bytes_copied gauge
413+
rts_gc_par_avg_bytes_copied 0
414+
# TYPE rts_gc_num_bytes_usage_samples counter
415+
rts_gc_num_bytes_usage_samples 4
416+
# TYPE remainingKESPeriods_int gauge
417+
remainingKESPeriods_int 62
418+
# TYPE rts_gc_bytes_copied counter
419+
rts_gc_bytes_copied 17114384
420+
# TYPE nodeCannotForge_int gauge
421+
# HELP nodeCannotForge_int How many times was this node unable to forge [a block]?
422+
# EOF
423+
```
424+
425+
Passing metric help annotations to the service can be done in the config file, either as a key-value map from metric name to help text, or as a seperate JSON file containing such a map.
426+
The system's internal metric names have to be used as keys (cf. [metrics documentation](https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/new-tracing/tracers_doc_generated.md#metrics)).
427+
```
428+
"metricsHelp": "path/to/key-value-map.json"
429+
```
430+
or
431+
```
432+
"metricsHelp": {
433+
"Mem.resident": "Kernel-reported RSS (resident set size)",
434+
"RTS.gcMajorNum": "Major GCs",
435+
"nodeCannotForge": "How many times was this node unable to forge [a block]?"
436+
}
405437
```
406438

439+
440+
407441
## EKG Monitoring
408442

409443
At top-level route `/` EKG gives a list of connected nodes.

cardano-tracer/src/Cardano/Tracer/Handlers/Metrics/Prometheus.hs

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,34 @@ import qualified System.Metrics as EKG
3535
import System.Metrics (Sample, Value (..), sampleAll)
3636
import System.Time.Extra (sleep)
3737

38-
-- | Runs simple HTTP server that listens host and port and returns
39-
-- the list of currently connected nodes in such a format:
38+
-- | Runs a simple HTTP server that listens on @endpoint@.
4039
--
41-
-- * relay-1
42-
-- * relay-2
43-
-- * core-1
40+
-- At the root, it lists the connected nodes, either as HTML or JSON, depending
41+
-- on the requests 'Accept: ' header.
4442
--
45-
-- where 'relay-1', 'relay-2' and 'core-1' are nodes' names.
43+
-- Routing is dynamic, depending on the connected nodes. A valid URL is derived
44+
-- from the nodeName configured for the connecting node. E.g. a node name
45+
-- of `127.0.0.1:30004` will result in the route `/12700130004` which
46+
-- renders that node's Prometheus / OpenMetrics text exposition:
4647
--
47-
-- Each of list items is a href. By clicking on it, the user will be
48-
-- redirected to the page with the list of metrics received from that node,
49-
-- in such a format:
50-
--
51-
-- rts_gc_par_tot_bytes_copied 0
52-
-- rts_gc_num_gcs 17
53-
-- rts_gc_max_bytes_slop 15888
54-
-- rts_gc_bytes_copied 165952
55-
-- ekg_server_timestamp_ms 1639569439623
48+
-- # TYPE Mem_resident_int gauge
49+
-- # HELP Mem_resident_int Kernel-reported RSS (resident set size)
50+
-- Mem_resident_int 103792640
51+
-- # TYPE rts_gc_max_bytes_used gauge
52+
-- rts_gc_max_bytes_used 5811512
53+
-- # TYPE rts_gc_gc_cpu_ms counter
54+
-- rts_gc_gc_cpu_ms 50
55+
-- # TYPE RTS_gcMajorNum_int gauge
56+
-- # HELP RTS_gcMajorNum_int Major GCs
57+
-- RTS_gcMajorNum_int 4
58+
-- # TYPE rts_gc_num_bytes_usage_samples counter
59+
-- rts_gc_num_bytes_usage_samples 4
60+
-- # TYPE remainingKESPeriods_int gauge
61+
-- remainingKESPeriods_int 62
62+
-- # TYPE rts_gc_bytes_copied counter
63+
-- rts_gc_bytes_copied 17114384
64+
-- # TYPE nodeCannotForge_int gauge
65+
-- # HELP nodeCannotForge_int How many times was this node unable to forge [a block]?
5666
--
5767
runPrometheusServer
5868
:: TracerEnv

0 commit comments

Comments
 (0)