Skip to content

Commit 2ec1a3a

Browse files
committed
prometheus: require python 3.9.2, add uv.lock, try fix port in use flake
1 parent 948c973 commit 2ec1a3a

File tree

5 files changed

+1601
-13
lines changed

5 files changed

+1601
-13
lines changed

prometheus/poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prometheus/prometheus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env -S uv run --script
22

33
# /// script
4-
# requires-python = ">=3.9"
4+
# requires-python = ">=3.9.2"
55
# dependencies = [
66
# "prometheus-client>=0.20.0",
77
# "pyln-client>=24.5"

prometheus/pyproject.toml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
[tool.poetry]
1+
[project]
22
name = "prometheus"
33
version = "0.1.0"
44
description = "A plugin that reports metrics to be collected by prometheus"
5-
authors = ["Christian Decker <decker@blockstream.com>"]
6-
license = "MIT"
75
readme = "README.md"
6+
authors = [{ name = "Christian Decker", email = "<decker@blockstream.io>" }]
7+
license = "MIT"
8+
requires-python = ">=3.9.2"
9+
dependencies = ["prometheus-client>=0.20.0", "pyln-client>=24.5"]
10+
11+
[dependency-groups]
12+
dev = [
13+
"pyln-testing>=24.5",
14+
"pytest-rerunfailures>=10.3",
15+
"pytest-timeout>=2.1.0",
16+
"pytest-xdist>=3.1.0",
17+
]
18+
19+
[tool.poetry]
820

921
[tool.poetry.dependencies]
10-
python = "^3.9"
22+
python = "^3.9.2"
1123
prometheus-client = "^0.20.0"
1224
pyln-client = "^25.5"
1325

prometheus/test_prometheus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
from pyln.testing.fixtures import * # noqa: F401,F403
33
import urllib
4-
from ephemeral_port_reserve import reserve
54

65
plugin_path = os.path.join(os.path.dirname(__file__), "prometheus.py")
76

@@ -21,13 +20,14 @@ def test_prometheus_starts(node_factory):
2120
def test_prometheus_scrape(node_factory):
2221
"""Test that we can scrape correctly.
2322
"""
24-
l1 = node_factory.get_node(options={'plugin': plugin_path})
25-
scrape = urllib.request.urlopen("http://localhost:9750")
23+
port = node_factory.get_unused_port()
24+
l1 = node_factory.get_node(options={'plugin': plugin_path, 'prometheus-listen': f'127.0.0.1:{port}'})
25+
scrape = urllib.request.urlopen(f"http://localhost:{port}")
2626

2727

2828

2929
def test_prometheus_channels(node_factory):
30-
port = reserve()
30+
port = node_factory.get_unused_port()
3131
l1, l2, l3 = node_factory.line_graph(
3232
3,
3333
opts=[

0 commit comments

Comments
 (0)