Skip to content

Commit 019f2bc

Browse files
author
macgyver13
committed
- Add grafana metric validation test to logging_test
- Reduced complexity of ln network.yaml config to align with ln_basic_test
1 parent 0ca00d0 commit 019f2bc

File tree

5 files changed

+31
-41
lines changed

5 files changed

+31
-41
lines changed

docs/logging_monitoring.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,11 @@ mempool_size 0.0
120120
121121
Lightning nodes can also be configured to export metrics to prometheus using `lnd-exporter`.
122122
Example configuration is provided in `test/data/ln/`. Review `node-defauts.yaml` for a typical logging configuration. All default metrics reported to prometheus are prefixed with `lnd_`
123-
lnd-exporter
124123
125124
[lnd-exporter configuration reference](https://github.com/macgyver13/lnd-exporter/tree/main?tab=readme-ov-file#configuration)
126-
lnd-exporter assumes same macarroon referenced in ln_framework (can be overridden by env variable)
125+
lnd-exporter assumes same macaroon referenced in ln_framework (can be overridden by env variable)
127126
128-
**Note: `test/data/ln` takes advantage of **extraContainers** configuration option to add containers to default `lnd/templates/pod`*
127+
**Note: `test/data/ln` and `test/data/logging` take advantage of **extraContainers** configuration option to add containers to default `lnd/templates/pod`*
129128
130129
### Grafana
131130

test/data/ln/network.yaml

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,15 @@ nodes:
22
- name: tank-0000
33
addnode:
44
- tank-0001
5-
- tank-0002
6-
lnd:
7-
channels:
8-
- id:
9-
block: 300
10-
index: 6
11-
target: tank-0001-ln
12-
capacity: 100000
13-
push_amt: 50000
145
- name: tank-0001
156
addnode:
16-
- tank-0000
17-
lnd:
18-
channels:
19-
- id:
20-
block: 300
21-
index: 5
22-
target: tank-0000-ln
23-
capacity: 50000
24-
push_amt: 25000
25-
- id:
26-
block: 300
27-
index: 4
28-
target: tank-0002-ln
29-
capacity: 100000
30-
push_amt: 50000
7+
- tank-0002
318
- name: tank-0002
329
addnode:
33-
- tank-0001
34-
lnd:
35-
channels:
36-
- id:
37-
block: 300
38-
index: 2
39-
target: tank-0001-ln
40-
capacity: 50000
41-
push_amt: 25000
10+
- tank-0000
4211
- name: tank-0003
4312
addnode:
44-
- tank-0002
13+
- tank-0000
4514
lnd:
4615
config: |
4716
bitcoin.timelockdelta=33
@@ -59,10 +28,10 @@ nodes:
5928
channels:
6029
- id:
6130
block: 300
62-
index: 3
31+
index: 2
6332
target: tank-0005-ln
6433
capacity: 50000
6534
push_amt: 25000
6635
- name: tank-0005
6736
addnode:
68-
- tank-0004
37+
- tank-0000

test/data/ln/node-defaults.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
# Enable caddy, collectLogs and metricsExport to activate publish lnd-exporter metrics
12
caddy:
2-
enabled: true
3+
enabled: false
34

45
#Core configs
56
image:
67
repository: bitcoindevproject/bitcoin
78
pullPolicy: IfNotPresent
8-
tag: '27.0'
9+
tag: "27.0"
910
collectLogs: false
1011
metricsExport: false
1112

test/data/logging/network.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,25 @@ nodes:
1111
- name: tank-0002
1212
addnode:
1313
- tank-0000
14+
ln:
15+
lnd: true
16+
lnd:
17+
metricsExport: true
18+
prometheusMetricsPort: 9332
19+
extraContainers:
20+
- name: lnd-exporter
21+
image: bitdonkey/lnd-exporter:0.1.1
22+
imagePullPolicy: IfNotPresent
23+
env:
24+
- name: ADMIN_MACAROON_HEX
25+
value: 0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620b17be53e367290871681055d0de15587f6d1cd47d1248fe2662ae27f62cfbdc6
26+
- name: METRICS
27+
value: >
28+
lnd_block_height=parse("/v1/getinfo","block_height")
29+
lnd_peers=parse("/v1/getinfo","num_peers")
30+
ports:
31+
- name: prom-metrics
32+
containerPort: 9332
33+
protocol: TCP
1434
caddy:
1535
enabled: true

test/logging_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def get_five_values_for_metric(metric):
9494

9595
self.wait_for_predicate(lambda: get_five_values_for_metric("blocks"))
9696
self.wait_for_predicate(lambda: get_five_values_for_metric("txrate"))
97+
self.wait_for_predicate(lambda: get_five_values_for_metric("lnd_block_height"))
9798

9899
# Verify default dashboard exists
99100
dbs = requests.get(f"{self.grafana_url}/api/search").json()

0 commit comments

Comments
 (0)