Skip to content

Commit d840874

Browse files
authored
Merge branch 'prometheus:master' into rlock
2 parents 05cd015 + 09a5ae3 commit d840874

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ workflows:
7575
matrix:
7676
parameters:
7777
python:
78-
- "3.8"
79-
- "3.9"
78+
- "3.8.18"
79+
- "3.9.18"
8080
- "3.10"
8181
- "3.11"
8282
- "3.12"

docs/content/exporting/http/asgi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ app = make_asgi_app()
1414
Such an application can be useful when integrating Prometheus metrics with ASGI
1515
apps.
1616

17-
By default, the WSGI application will respect `Accept-Encoding:gzip` headers used by Prometheus
17+
By default, the ASGI application will respect `Accept-Encoding:gzip` headers used by Prometheus
1818
and compress the response if such a header is present. This behaviour can be disabled by passing
1919
`disable_compression=True` when creating the app, like this:
2020

2121
```python
2222
app = make_asgi_app(disable_compression=True)
23-
```
23+
```

docs/content/exporting/http/fastapi-gunicorn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ metrics_app = make_asgi_app()
1919
app.mount("/metrics", metrics_app)
2020
```
2121

22-
For Multiprocessing support, use this modified code snippet. Full multiprocessing instructions are provided [here](https://github.com/prometheus/client_python#multiprocess-mode-eg-gunicorn).
22+
For Multiprocessing support, use this modified code snippet. Full multiprocessing instructions are provided [here]({{< ref "/multiprocess" >}}).
2323

2424
```python
2525
from fastapi import FastAPI
@@ -47,4 +47,4 @@ pip install gunicorn
4747
gunicorn -b 127.0.0.1:8000 myapp:app -k uvicorn.workers.UvicornWorker
4848
```
4949

50-
Visit http://localhost:8000/metrics to see the metrics
50+
Visit http://localhost:8000/metrics to see the metrics

prometheus_client/metrics.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ def info(self, val: Dict[str, str]) -> None:
704704
if self._labelname_set.intersection(val.keys()):
705705
raise ValueError('Overlapping labels for Info metric, metric: {} child: {}'.format(
706706
self._labelnames, val))
707+
if any(i is None for i in val.values()):
708+
raise ValueError('Label value cannot be None')
707709
with self._lock:
708710
self._value = dict(val)
709711

prometheus_client/samples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def __ne__(self, other: object) -> bool:
2828
return not self == other
2929

3030
def __gt__(self, other: "Timestamp") -> bool:
31-
return self.sec > other.sec or self.nsec > other.nsec
31+
return self.nsec > other.nsec if self.sec == other.sec else self.sec > other.sec
3232

3333
def __lt__(self, other: "Timestamp") -> bool:
34-
return self.sec < other.sec or self.nsec < other.nsec
34+
return self.nsec < other.nsec if self.sec == other.sec else self.sec < other.sec
3535

3636

3737
# Timestamp and exemplar are optional.

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ def test_info(self):
534534

535535
def test_labels(self):
536536
self.assertRaises(ValueError, self.labels.labels('a').info, {'l': ''})
537+
self.assertRaises(ValueError, self.labels.labels('a').info, {'il': None})
537538

538539
self.labels.labels('a').info({'foo': 'bar'})
539540
self.assertEqual(1, self.registry.get_sample_value('il_info', {'l': 'a', 'foo': 'bar'}))

tests/test_samples.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def test_gt(self):
1212
self.assertEqual(samples.Timestamp(1, 2) > samples.Timestamp(1, 1), True)
1313
self.assertEqual(samples.Timestamp(2, 1) > samples.Timestamp(1, 1), True)
1414
self.assertEqual(samples.Timestamp(2, 2) > samples.Timestamp(1, 1), True)
15+
self.assertEqual(samples.Timestamp(0, 2) > samples.Timestamp(1, 1), False)
16+
self.assertEqual(samples.Timestamp(2, 0) > samples.Timestamp(1, 1), True)
1517

1618
def test_lt(self):
1719
self.assertEqual(samples.Timestamp(1, 1) < samples.Timestamp(1, 1), False)
@@ -21,6 +23,8 @@ def test_lt(self):
2123
self.assertEqual(samples.Timestamp(1, 2) < samples.Timestamp(1, 1), False)
2224
self.assertEqual(samples.Timestamp(2, 1) < samples.Timestamp(1, 1), False)
2325
self.assertEqual(samples.Timestamp(2, 2) < samples.Timestamp(1, 1), False)
26+
self.assertEqual(samples.Timestamp(0, 2) < samples.Timestamp(1, 1), True)
27+
self.assertEqual(samples.Timestamp(2, 0) < samples.Timestamp(1, 1), False)
2428

2529

2630
if __name__ == '__main__':

0 commit comments

Comments
 (0)