Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-prometheus-client for
openSUSE:Factory checked in at 2022-10-14 15:42:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-prometheus-client (Old)
and /work/SRC/openSUSE:Factory/.python-prometheus-client.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-prometheus-client"
Fri Oct 14 15:42:45 2022 rev:7 rq:1010625 version:0.15.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-prometheus-client/python-prometheus-client.changes
2022-06-05 21:28:51.965073467 +0200
+++
/work/SRC/openSUSE:Factory/.python-prometheus-client.new.2275/python-prometheus-client.changes
2022-10-14 15:44:01.068066532 +0200
@@ -1,0 +2,11 @@
+Fri Oct 14 01:18:51 UTC 2022 - Michael Str??der <[email protected]>
+
+- Update to upstream 0.15.0 release
+ * [CHANGE] Remove choose_formatter. choose_formatter only existed
+ for v0.14.x and was deprecated in v0.14.1. #846
+ * [FEATURE] Support TLS auth when using push gateway with
+ tls_auth_handler. #841
+ * [ENHANCEMENT] Add sum, livemin, and livemax multiprocess
+ modes for Gauges. #794
+
+-------------------------------------------------------------------
Old:
----
v0.14.1.tar.gz
New:
----
v0.15.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-prometheus-client.spec ++++++
--- /var/tmp/diff_new_pack.QxfvJp/_old 2022-10-14 15:44:01.540067319 +0200
+++ /var/tmp/diff_new_pack.QxfvJp/_new 2022-10-14 15:44:01.544067327 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-prometheus-client
-Version: 0.14.1
+Version: 0.15.0
Release: 0
Summary: Python client for the Prometheus monitoring system
License: Apache-2.0
++++++ v0.14.1.tar.gz -> v0.15.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/CODE_OF_CONDUCT.md
new/client_python-0.15.0/CODE_OF_CONDUCT.md
--- old/client_python-0.14.1/CODE_OF_CONDUCT.md 2022-04-08 18:04:07.000000000
+0200
+++ new/client_python-0.15.0/CODE_OF_CONDUCT.md 2022-10-13 15:55:57.000000000
+0200
@@ -1,3 +1,3 @@
-## Prometheus Community Code of Conduct
+# Prometheus Community Code of Conduct
-Prometheus follows the [CNCF Code of
Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
+Prometheus follows the [CNCF Code of
Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/README.md
new/client_python-0.15.0/README.md
--- old/client_python-0.14.1/README.md 2022-04-08 18:04:07.000000000 +0200
+++ new/client_python-0.15.0/README.md 2022-10-13 15:55:57.000000000 +0200
@@ -47,7 +47,7 @@
## Installation
```
-pip install prometheus_client
+pip install prometheus-client
```
This package can be found on
@@ -278,6 +278,18 @@
labels on the `python_info` metric. The value of the metric is 1, since it is
the
labels that carry information.
+### Disabling Default Collector metrics
+
+By default the collected `process`, `gc`, and `platform` collector metrics are
exported.
+If this information is not helpful, it can be disabled using the following:
+```python
+import prometheus_client
+
+prometheus_client.REGISTRY.unregister(prometheus_client.GC_COLLECTOR)
+prometheus_client.REGISTRY.unregister(prometheus_client.PLATFORM_COLLECTOR)
+prometheus_client.REGISTRY.unregister(prometheus_client.PROCESS_COLLECTOR)
+```
+
## Exporting
There are several options for exporting metrics.
@@ -471,6 +483,24 @@
push_to_gateway('localhost:9091', job='batchA', registry=registry,
handler=my_auth_handler)
```
+TLS Auth is also supported when using the push gateway with a special handler.
+
+```python
+from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
+from prometheus_client.exposition import tls_handler
+
+
+def my_auth_handler(url, method, timeout, headers, data):
+ certfile = 'client-crt.pem'
+ keyfile = 'client-key.pem'
+ return tls_auth_handler(url, method, timeout, headers, data, certfile,
keyfile)
+
+registry = CollectorRegistry()
+g = Gauge('job_last_success_unixtime', 'Last time a batch job successfully
finished', registry=registry)
+g.set_to_current_time()
+push_to_gateway('localhost:9091', job='batchA', registry=registry,
handler=my_auth_handler)
+```
+
## Bridges
It is also possible to expose metrics to systems other than Prometheus.
@@ -609,14 +639,17 @@
**4. Metrics tuning (Gauge)**:
-When `Gauge` metrics are used, additional tuning needs to be performed.
+When `Gauge`s are used in multiprocess applications,
+you must decide how to handle the metrics reported by each process.
Gauges have several modes they can run in, which can be selected with the
`multiprocess_mode` parameter.
-- 'all': Default. Return a timeseries per process alive or dead.
-- 'liveall': Return a timeseries per process that is still alive.
-- 'livesum': Return a single timeseries that is the sum of the values of alive
processes.
-- 'max': Return a single timeseries that is the maximum of the values of all
processes, alive or dead.
-- 'min': Return a single timeseries that is the minimum of the values of all
processes, alive or dead.
+- 'all': Default. Return a timeseries per process (alive or dead), labelled by
the process's `pid` (the label is added internally).
+- 'min': Return a single timeseries that is the minimum of the values of all
processes (alive or dead).
+- 'max': Return a single timeseries that is the maximum of the values of all
processes (alive or dead).
+- 'sum': Return a single timeseries that is the sum of the values of all
processes (alive or dead).
+
+Prepend 'live' to the beginning of the mode to return the same result but only
considering living processes
+(e.g., 'liveall, 'livesum', 'livemax', 'livemin').
```python
from prometheus_client import Gauge
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/SECURITY.md
new/client_python-0.15.0/SECURITY.md
--- old/client_python-0.14.1/SECURITY.md 2022-04-08 18:04:07.000000000
+0200
+++ new/client_python-0.15.0/SECURITY.md 2022-10-13 15:55:57.000000000
+0200
@@ -3,4 +3,4 @@
The Prometheus security policy, including how to report vulnerabilities, can be
found here:
-https://prometheus.io/docs/operating/security/
+<https://prometheus.io/docs/operating/security/>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/prometheus_client/exposition.py
new/client_python-0.15.0/prometheus_client/exposition.py
--- old/client_python-0.14.1/prometheus_client/exposition.py 2022-04-08
18:04:07.000000000 +0200
+++ new/client_python-0.15.0/prometheus_client/exposition.py 2022-10-13
15:55:57.000000000 +0200
@@ -5,15 +5,16 @@
import os
import socket
from socketserver import ThreadingMixIn
+import ssl
import sys
import threading
-from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
+from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
from urllib.error import HTTPError
from urllib.parse import parse_qs, quote_plus, urlparse
from urllib.request import (
- build_opener, HTTPHandler, HTTPRedirectHandler, Request,
+ BaseHandler, build_opener, HTTPHandler, HTTPRedirectHandler, HTTPSHandler,
+ Request,
)
-import warnings
from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer
from .openmetrics import exposition as openmetrics
@@ -247,15 +248,6 @@
return generate_latest, CONTENT_TYPE_LATEST
-def choose_formatter(accept_header: str) ->
Tuple[Callable[[CollectorRegistry], bytes], str]:
- warnings.warn(
- "choose_formatter is deprecated and will be removed in 0.15.0, please
use choose_encoder instead",
- DeprecationWarning,
- stacklevel=2
- )
- return choose_encoder(accept_header)
-
-
def gzip_accepted(accept_encoding_header: str) -> bool:
accept_encoding_header = accept_encoding_header or ''
for accepted in accept_encoding_header.split(','):
@@ -324,7 +316,7 @@
timeout: Optional[float],
headers: Sequence[Tuple[str, str]],
data: bytes,
- base_handler: type,
+ base_handler: Union[BaseHandler, type],
) -> Callable[[], None]:
def handle() -> None:
request = Request(url, data=data)
@@ -399,6 +391,40 @@
return handle
+def tls_auth_handler(
+ url: str,
+ method: str,
+ timeout: Optional[float],
+ headers: List[Tuple[str, str]],
+ data: bytes,
+ certfile: str,
+ keyfile: str,
+ cafile: Optional[str] = None,
+ protocol: int = ssl.PROTOCOL_TLS_CLIENT,
+ insecure_skip_verify: bool = False,
+) -> Callable[[], None]:
+ """Handler that implements an HTTPS connection with TLS Auth.
+
+ The default protocol (ssl.PROTOCOL_TLS_CLIENT) will also enable
+ ssl.CERT_REQUIRED and SSLContext.check_hostname by default. This can be
+ disabled by setting insecure_skip_verify to True.
+
+ Both this handler and the TLS feature on pushgateay are experimental."""
+ context = ssl.SSLContext(protocol=protocol)
+ if cafile is not None:
+ context.load_verify_locations(cafile)
+ else:
+ context.load_default_certs()
+
+ if insecure_skip_verify:
+ context.check_hostname = False
+ context.verify_mode = ssl.CERT_NONE
+
+ context.load_cert_chain(certfile=certfile, keyfile=keyfile)
+ handler = HTTPSHandler(context=context)
+ return _make_handler(url, method, timeout, headers, data, handler)
+
+
def push_to_gateway(
gateway: str,
job: str,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/prometheus_client/metrics.py
new/client_python-0.15.0/prometheus_client/metrics.py
--- old/client_python-0.14.1/prometheus_client/metrics.py 2022-04-08
18:04:07.000000000 +0200
+++ new/client_python-0.15.0/prometheus_client/metrics.py 2022-10-13
15:55:57.000000000 +0200
@@ -346,7 +346,7 @@
d.set_function(lambda: len(my_dict))
"""
_type = 'gauge'
- _MULTIPROC_MODES = frozenset(('min', 'max', 'livesum', 'liveall', 'all'))
+ _MULTIPROC_MODES = frozenset(('all', 'liveall', 'min', 'livemin', 'max',
'livemax', 'sum', 'livesum'))
def __init__(self,
name: str,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/client_python-0.14.1/prometheus_client/multiprocess.py
new/client_python-0.15.0/prometheus_client/multiprocess.py
--- old/client_python-0.14.1/prometheus_client/multiprocess.py 2022-04-08
18:04:07.000000000 +0200
+++ new/client_python-0.15.0/prometheus_client/multiprocess.py 2022-10-13
15:55:57.000000000 +0200
@@ -4,6 +4,7 @@
import os
import warnings
+from .metrics import Gauge
from .metrics_core import Metric
from .mmap_dict import MmapedDict
from .samples import Sample
@@ -63,8 +64,8 @@
try:
file_values = MmapedDict.read_all_values_from_file(f)
except FileNotFoundError:
- if typ == 'gauge' and parts[1] in ('liveall', 'livesum'):
- # Those files can disappear between the glob of collect
+ if typ == 'gauge' and parts[1].startswith('live'):
+ # Files for 'live*' gauges can be deleted between the glob
of collect
# and now (via a mark_process_dead call) so don't fail if
# the file is missing
continue
@@ -96,15 +97,15 @@
name, labels, value, timestamp, exemplar = s
if metric.type == 'gauge':
without_pid_key = (name, tuple(l for l in labels if l[0]
!= 'pid'))
- if metric._multiprocess_mode == 'min':
+ if metric._multiprocess_mode in ('min', 'livemin'):
current = samples_setdefault(without_pid_key, value)
if value < current:
samples[without_pid_key] = value
- elif metric._multiprocess_mode == 'max':
+ elif metric._multiprocess_mode in ('max', 'livemax'):
current = samples_setdefault(without_pid_key, value)
if value > current:
samples[without_pid_key] = value
- elif metric._multiprocess_mode == 'livesum':
+ elif metric._multiprocess_mode in ('sum', 'livesum'):
samples[without_pid_key] += value
else: # all/liveall
samples[(name, labels)] = value
@@ -152,11 +153,13 @@
return self.merge(files, accumulate=True)
+_LIVE_GAUGE_MULTIPROCESS_MODES = {m for m in Gauge._MULTIPROC_MODES if
m.startswith('live')}
+
+
def mark_process_dead(pid, path=None):
"""Do bookkeeping for when one process dies in a multi-process setup."""
if path is None:
path = os.environ.get('PROMETHEUS_MULTIPROC_DIR',
os.environ.get('prometheus_multiproc_dir'))
- for f in glob.glob(os.path.join(path, f'gauge_livesum_{pid}.db')):
- os.remove(f)
- for f in glob.glob(os.path.join(path, f'gauge_liveall_{pid}.db')):
- os.remove(f)
+ for mode in _LIVE_GAUGE_MULTIPROCESS_MODES:
+ for f in glob.glob(os.path.join(path, f'gauge_{mode}_{pid}.db')):
+ os.remove(f)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/setup.py
new/client_python-0.15.0/setup.py
--- old/client_python-0.14.1/setup.py 2022-04-08 18:04:07.000000000 +0200
+++ new/client_python-0.15.0/setup.py 2022-10-13 15:55:57.000000000 +0200
@@ -8,7 +8,7 @@
setup(
name="prometheus_client",
- version="0.14.1",
+ version="0.15.0",
author="Brian Brazil",
author_email="[email protected]",
description="Python client for the Prometheus monitoring system.",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/tests/certs/cert.pem
new/client_python-0.15.0/tests/certs/cert.pem
--- old/client_python-0.14.1/tests/certs/cert.pem 1970-01-01
01:00:00.000000000 +0100
+++ new/client_python-0.15.0/tests/certs/cert.pem 2022-10-13
15:55:57.000000000 +0200
@@ -0,0 +1,32 @@
+-----BEGIN CERTIFICATE-----
+MIIFkzCCA3ugAwIBAgIUWhYKmrh+gF5pZ7Yqj41cWJ2pRzkwDQYJKoZIhvcNAQEL
+BQAwWTELMAkGA1UEBhMCVVMxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
+GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDESMBAGA1UEAwwJbG9jYWxob3N0MB4X
+DTIyMDkyMDE4NTQzOFoXDTIyMTAyMDE4NTQzOFowWTELMAkGA1UEBhMCVVMxEzAR
+BgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5
+IEx0ZDESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
+MIICCgKCAgEAxs6v9c/bNtA0TjNOzSoIq2CQuBhjWt8nwVG7Ujn3JBSvC263foRq
+OG0oGhaFrbt4HrbikYeSo5u/0CDBfKBIr7nuWifpISUovNSm2EVgVL7YQhgPOSvb
+PiJhrflfkUBZWUlNf0EAcFOn29xSvw3ElDUtxqUql39RRXUah1JDIIJpFPENwbmB
+4jN5AoumdzSZde3S1xAXqoPf7gwxvsIgBKYGxRZs95DLx3HwesDAmRdmXcLShNZm
+RpUbIbomn4w3mf7S0QZ7H49/IHRghw61/TGKCX6ieJ8QTWwnBgo9EiwhhuTCV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M4wdVg40yr6BVZqy2OPqDn64q0pAgMHG24XrxxuaFISjgPOgx
+bYhhTUG/4Dkb1BWhfEv4EwEf/uDxhHE8k6LoKk3Qb+aOzPr2PKGvW3yBHEFNSmKH
+x3SB8xxj/IOiA+em+TLtKd66gG0T0b8cPt037k+D3a0BqC9d2sVs
+-----END CERTIFICATE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/tests/certs/key.pem
new/client_python-0.15.0/tests/certs/key.pem
--- old/client_python-0.14.1/tests/certs/key.pem 1970-01-01
01:00:00.000000000 +0100
+++ new/client_python-0.15.0/tests/certs/key.pem 2022-10-13
15:55:57.000000000 +0200
@@ -0,0 +1,52 @@
+-----BEGIN PRIVATE KEY-----
+MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQDGzq/1z9s20DRO
+M07NKgirYJC4GGNa3yfBUbtSOfckFK8Lbrd+hGo4bSgaFoWtu3getuKRh5Kjm7/Q
+IMF8oEivue5aJ+khJSi81KbYRWBUvthCGA85K9s+ImGt+V+RQFlZSU1/QQBwU6fb
+3FK/DcSUNS3GpSqXf1FFdRqHUkMggmkU8Q3BuYHiM3kCi6Z3NJl17dLXEBeqg9/u
+DDG+wiAEpgbFFmz3kMvHcfB6wMCZF2ZdwtKE1mZGlRshuiafjDeZ/tLRBnsfj38g
+dGCHDrX9MYoJfqJ4nxBNbCcGCj0SLCGG5MJW0XAgWHNDLmw/ZvqZiTFArh6diIeR
+MQcRJ1X2KkOjJl8Tcb5aiMRrrk5iSsEVplu4nyqUGNEID6nJd/FrjReQrjHdqJu9
+0p4fUIYT6tiHE9gLp6a7QmTXAw7lM19/Ya/54m8YRBe7JA8LlKaBKnLS1bA71F5i
+YNTX76BuYVlzVBUHQYj9bGAX4+kEERrydoVfFt5lYbdDqkV+sgneluFvWWROWTbO
+kk7aFMNQgEifql1UFu/5ACoLK73iAi19TFZY0v1IdP51/JfgK2kX1H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P9zr+54i3aIKtNhBIXpdAGB9FH79/7KPB8n0GD1R6a
+J3ISjFdUExmhtI0JpIwW69XNjepBUB976C4zZ6c+XAkRrP1nAMmzl0G6dExaaizZ
+AQKCAQATD1sklHGmkwNtw5g51G7eC8mJeS8TKK+nlWNaIPcd8LIWc5XnECYlRrt/
+pYv74Dwqw+ze6I8W2FlhvSYAheGgYlijzhDlbArdr7jQLFcyRESu27koqwHSTkxM
+Bt46VS4UrlIk4bAp8/WwXUrGrQ3P094R7wJ2jN3Jp4/tG0C+igti4b12KfM+srkC
+/N5BiyLLl4H4l1TMFyhuQyY7QsqgWkEJQoYbI+see7m/8IlnU+mxGj8q6aWiTmVG
+52ZOak9AV0SoHSIPChpin5J3kNDQ2z/oC3UhyHZBHwWCGj8AOTy+M1HIcVNPzCga
+YdxZTB2pN96tqnBm8vyvi81Cdy/x
+-----END PRIVATE KEY-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/tests/test_exposition.py
new/client_python-0.15.0/tests/test_exposition.py
--- old/client_python-0.14.1/tests/test_exposition.py 2022-04-08
18:04:07.000000000 +0200
+++ new/client_python-0.15.0/tests/test_exposition.py 2022-10-13
15:55:57.000000000 +0200
@@ -1,8 +1,8 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
+import os
import threading
import time
import unittest
-import warnings
import pytest
@@ -13,8 +13,8 @@
)
from prometheus_client.core import GaugeHistogramMetricFamily, Timestamp
from prometheus_client.exposition import (
- basic_auth_handler, choose_encoder, choose_formatter, default_handler,
- MetricsHandler, passthrough_redirect_handler,
+ basic_auth_handler, choose_encoder, default_handler, MetricsHandler,
+ passthrough_redirect_handler, tls_auth_handler,
)
import prometheus_client.openmetrics.exposition as openmetrics
@@ -343,6 +343,17 @@
self.assertEqual(self.requests[0][0].headers.get('content-type'),
CONTENT_TYPE_LATEST)
self.assertEqual(self.requests[0][1], b'# HELP g help\n# TYPE g
gauge\ng 0.0\n')
+ def test_push_with_tls_auth_handler(self):
+ def my_auth_handler(url, method, timeout, headers, data):
+ certs_dir =
os.path.join(os.path.dirname(os.path.realpath(__file__)), 'certs')
+ return tls_auth_handler(url, method, timeout, headers, data,
os.path.join(certs_dir, "cert.pem"), os.path.join(certs_dir, "key.pem"))
+
+ push_to_gateway(self.address, "my_job_with_tls_auth", self.registry,
handler=my_auth_handler)
+ self.assertEqual(self.requests[0][0].command, 'PUT')
+ self.assertEqual(self.requests[0][0].path,
'/metrics/job/my_job_with_tls_auth')
+ self.assertEqual(self.requests[0][0].headers.get('content-type'),
CONTENT_TYPE_LATEST)
+ self.assertEqual(self.requests[0][1], b'# HELP g help\n# TYPE g
gauge\ng 0.0\n')
+
def test_push_with_redirect_handler(self):
def my_redirect_handler(url, method, timeout, headers, data):
return passthrough_redirect_handler(url, method, timeout, headers,
data)
@@ -468,13 +479,5 @@
assert choose_encoder(openmetrics.CONTENT_TYPE_LATEST) ==
(openmetrics.generate_latest, openmetrics.CONTENT_TYPE_LATEST)
-def test_choose_formatter():
- with warnings.catch_warnings(record=True) as w:
- assert choose_formatter('') == (generate_latest, CONTENT_TYPE_LATEST)
- assert len(w) == 1
- assert issubclass(w[-1].category, DeprecationWarning)
- assert "choose_formatter is deprecated" in str(w[-1].message)
-
-
if __name__ == '__main__':
unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/client_python-0.14.1/tests/test_multiprocess.py
new/client_python-0.15.0/tests/test_multiprocess.py
--- old/client_python-0.14.1/tests/test_multiprocess.py 2022-04-08
18:04:07.000000000 +0200
+++ new/client_python-0.15.0/tests/test_multiprocess.py 2022-10-13
15:55:57.000000000 +0200
@@ -132,6 +132,17 @@
g2.set(2)
self.assertEqual(1, self.registry.get_sample_value('g'))
+ def test_gauge_livemin(self):
+ g1 = Gauge('g', 'help', registry=None, multiprocess_mode='livemin')
+ values.ValueClass = MultiProcessValue(lambda: 456)
+ g2 = Gauge('g', 'help', registry=None, multiprocess_mode='livemin')
+ self.assertEqual(0, self.registry.get_sample_value('g'))
+ g1.set(1)
+ g2.set(2)
+ self.assertEqual(1, self.registry.get_sample_value('g'))
+ mark_process_dead(123, os.environ['PROMETHEUS_MULTIPROC_DIR'])
+ self.assertEqual(2, self.registry.get_sample_value('g'))
+
def test_gauge_max(self):
g1 = Gauge('g', 'help', registry=None, multiprocess_mode='max')
values.ValueClass = MultiProcessValue(lambda: 456)
@@ -141,6 +152,28 @@
g2.set(2)
self.assertEqual(2, self.registry.get_sample_value('g'))
+ def test_gauge_livemax(self):
+ g1 = Gauge('g', 'help', registry=None, multiprocess_mode='livemax')
+ values.ValueClass = MultiProcessValue(lambda: 456)
+ g2 = Gauge('g', 'help', registry=None, multiprocess_mode='livemax')
+ self.assertEqual(0, self.registry.get_sample_value('g'))
+ g1.set(2)
+ g2.set(1)
+ self.assertEqual(2, self.registry.get_sample_value('g'))
+ mark_process_dead(123, os.environ['PROMETHEUS_MULTIPROC_DIR'])
+ self.assertEqual(1, self.registry.get_sample_value('g'))
+
+ def test_gauge_sum(self):
+ g1 = Gauge('g', 'help', registry=None, multiprocess_mode='sum')
+ values.ValueClass = MultiProcessValue(lambda: 456)
+ g2 = Gauge('g', 'help', registry=None, multiprocess_mode='sum')
+ self.assertEqual(0, self.registry.get_sample_value('g'))
+ g1.set(1)
+ g2.set(2)
+ self.assertEqual(3, self.registry.get_sample_value('g'))
+ mark_process_dead(123, os.environ['PROMETHEUS_MULTIPROC_DIR'])
+ self.assertEqual(3, self.registry.get_sample_value('g'))
+
def test_gauge_livesum(self):
g1 = Gauge('g', 'help', registry=None, multiprocess_mode='livesum')
values.ValueClass = MultiProcessValue(lambda: 456)