Skip to content

Commit 18858b6

Browse files
committed
update zenlib dep, make base metric get .value from _value() if it
exists. Signed-off-by: Zen <[email protected]>
1 parent f239e19 commit 18858b6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "prometheus_exporter"
7-
version = "0.7.2"
7+
version = "0.8.0"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]
@@ -17,7 +17,7 @@ classifiers = [
1717
"Operating System :: OS Independent",
1818
]
1919
dependencies = [
20-
"zenlib >= 1.1.1"
20+
"zenlib >= 1.6.1"
2121
]
2222

2323
[project.scripts]

src/prometheus_exporter/metric.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def __setattr__(self, name, value):
4646
raise TypeError('Value must be an integer or float')
4747
super().__setattr__(name, value)
4848

49+
def __getattribute__(self, name):
50+
""" Return the result of value() if the method exists, otherwise return the attribute """
51+
if name == 'value' and hasattr(self, '_value'):
52+
return self._value()
53+
return super().__getattribute__(name)
54+
4955
def __str__(self):
5056
""" Get a string representation of the metric for Prometheus """
5157
# Start by adding the help text if it exists

0 commit comments

Comments
 (0)