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 2021-06-02 22:12:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-prometheus_client (Old)
 and      /work/SRC/openSUSE:Factory/.python-prometheus_client.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-prometheus_client"

Wed Jun  2 22:12:25 2021 rev:13 rq:896956 version:0.11.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-prometheus_client/python-prometheus_client.changes
        2021-04-10 15:28:08.426432318 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-prometheus_client.new.1898/python-prometheus_client.changes
      2021-06-02 22:12:50.916062841 +0200
@@ -1,0 +2,10 @@
+Wed Jun  2 13:19:47 UTC 2021 - Michael Str??der <mich...@stroeder.com>
+
+- Update to upstream 0.11.0 release
+  * [CHANGE] Specify that the labelvalues argument on metric constructors
+    is internal by renaming it to _labelvalues. If you are affected by this
+    change, it is likely that the metric was not being registered. #660
+  * [BUGFIX] write_to_textfile will overwrite files in windows. If using
+    python 3.4 or newer the replace will be atomic. #650
+
+-------------------------------------------------------------------

Old:
----
  v0.10.1.tar.gz

New:
----
  v0.11.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-prometheus_client.spec ++++++
--- /var/tmp/diff_new_pack.XUFhgr/_old  2021-06-02 22:12:51.964060250 +0200
+++ /var/tmp/diff_new_pack.XUFhgr/_new  2021-06-02 22:12:51.964060250 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-prometheus_client
-Version:        0.10.1
+Version:        0.11.0
 Release:        0
 Summary:        Python client for the Prometheus monitoring system
 License:        Apache-2.0

++++++ v0.10.1.tar.gz -> v0.11.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.10.1/README.md 
new/client_python-0.11.0/README.md
--- old/client_python-0.10.1/README.md  2021-04-08 18:30:13.000000000 +0200
+++ new/client_python-0.11.0/README.md  2021-06-01 19:19:33.000000000 +0200
@@ -494,7 +494,7 @@
 return an empty list.
 
 
-## Multiprocess Mode (Gunicorn)
+## Multiprocess Mode (E.g. Gunicorn)
 
 Prometheus client libraries presume a threaded model, where metrics are shared
 across workers. This doesn't work so well for languages such as Python where
@@ -504,6 +504,8 @@
 This comes with a number of limitations:
 
 - Registries can not be used as normal, all instantiated metrics are exported
+  - Registering metrics to a registry later used by a `MultiProcessCollector`
+    may cause duplicate metrics to be exported
 - Custom collectors do not work (e.g. cpu and memory metrics)
 - Info and Enum metrics do not work
 - The pushgateway cannot be used
@@ -511,23 +513,29 @@
 
 There's several steps to getting this working:
 
-**1. Gunicorn deployment**:
+**1. Deployment**:
 
-The `prometheus_multiproc_dir` environment variable must be set to a directory
+The `PROMETHEUS_MULTIPROC_DIR` environment variable must be set to a directory
 that the client library can use for metrics. This directory must be wiped
-between Gunicorn runs (before startup is recommended).
+between process/Gunicorn runs (before startup is recommended).
 
 This environment variable should be set from a start-up shell script,
 and not directly from Python (otherwise it may not propagate to child 
processes).
 
 **2. Metrics collector**:
 
-The application must initialize a new `CollectorRegistry`,
-and store the multi-process collector inside.
+The application must initialize a new `CollectorRegistry`, and store the
+multi-process collector inside. It is a best practice to create this registry
+inside the context of a request to avoid metrics registering themselves to a
+collector used by a `MultiProcessCollector`. If a registry with metrics
+registered is used by a `MultiProcessCollector` duplicate metrics may be
+exported, one for multiprocess, and one for the process serving the request.
 
 ```python
 from prometheus_client import multiprocess
-from prometheus_client import generate_latest, CollectorRegistry, 
CONTENT_TYPE_LATEST
+from prometheus_client import generate_latest, CollectorRegistry, 
CONTENT_TYPE_LATEST, Counter
+
+MY_COUNTER = Counter('my_counter', 'Description of my counter')
 
 # Expose metrics.
 def app(environ, start_response):
@@ -586,3 +594,8 @@
   for sample in family.samples:
     print("Name: {0} Labels: {1} Value: {2}".format(*sample))
 ```
+
+## Links
+
+* [Releases](https://github.com/prometheus/client_python/releases): The 
releases page shows the history of the project and acts as a changelog.
+* [PyPI](https://pypi.python.org/pypi/prometheus_client)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.10.1/prometheus_client/exposition.py 
new/client_python-0.11.0/prometheus_client/exposition.py
--- old/client_python-0.10.1/prometheus_client/exposition.py    2021-04-08 
18:30:13.000000000 +0200
+++ new/client_python-0.11.0/prometheus_client/exposition.py    2021-06-01 
19:19:33.000000000 +0200
@@ -271,8 +271,24 @@
     tmppath = '%s.%s.%s' % (path, os.getpid(), 
threading.current_thread().ident)
     with open(tmppath, 'wb') as f:
         f.write(generate_latest(registry))
-    # rename(2) is atomic.
-    os.rename(tmppath, path)
+    
+    # rename(2) is atomic but fails on Windows if the destination file exists
+    if os.name == 'nt':
+        if sys.version_info <= (3, 3):
+            # Unable to guarantee atomic rename on Windows and Python<3.3
+            # Remove and rename instead (risks losing the file)
+            try:
+                os.remove(path)
+            except FileNotFoundError:
+                pass
+
+            os.rename(tmppath, path)
+        else:
+            # os.replace is introduced in Python 3.3 but there is some dispute 
whether
+            # it is a truly atomic file operation: 
https://bugs.python.org/issue8828
+            os.replace(tmppath, path)
+    else:
+        os.rename(tmppath, path)
 
 
 def _make_handler(url, method, timeout, headers, data, base_handler):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.10.1/prometheus_client/metrics.py 
new/client_python-0.11.0/prometheus_client/metrics.py
--- old/client_python-0.10.1/prometheus_client/metrics.py       2021-04-08 
18:30:13.000000000 +0200
+++ new/client_python-0.11.0/prometheus_client/metrics.py       2021-06-01 
19:19:33.000000000 +0200
@@ -95,11 +95,11 @@
                  subsystem='',
                  unit='',
                  registry=REGISTRY,
-                 labelvalues=None,
+                 _labelvalues=None,
                  ):
         self._name = _build_full_name(self._type, name, namespace, subsystem, 
unit)
         self._labelnames = _validate_labelnames(self, labelnames)
-        self._labelvalues = tuple(labelvalues or ())
+        self._labelvalues = tuple(_labelvalues or ())
         self._kwargs = {}
         self._documentation = documentation
         self._unit = unit
@@ -170,7 +170,7 @@
                     documentation=self._documentation,
                     labelnames=self._labelnames,
                     unit=self._unit,
-                    labelvalues=labelvalues,
+                    _labelvalues=labelvalues,
                     **self._kwargs
                 )
             return self._metrics[labelvalues]
@@ -327,7 +327,7 @@
                  subsystem='',
                  unit='',
                  registry=REGISTRY,
-                 labelvalues=None,
+                 _labelvalues=None,
                  multiprocess_mode='all',
                  ):
         self._multiprocess_mode = multiprocess_mode
@@ -341,7 +341,7 @@
             subsystem=subsystem,
             unit=unit,
             registry=registry,
-            labelvalues=labelvalues,
+            _labelvalues=_labelvalues,
         )
         self._kwargs['multiprocess_mode'] = self._multiprocess_mode
 
@@ -441,7 +441,15 @@
         self._created = time.time()
 
     def observe(self, amount):
-        """Observe the given amount."""
+        """Observe the given amount.
+
+        The amount is usually positive or zero. Negative values are
+        accepted but prevent current versions of Prometheus from
+        properly detecting counter resets in the sum of
+        observations. See
+        
https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations
+        for details.
+        """
         self._count.inc(1)
         self._sum.inc(amount)
 
@@ -507,7 +515,7 @@
                  subsystem='',
                  unit='',
                  registry=REGISTRY,
-                 labelvalues=None,
+                 _labelvalues=None,
                  buckets=DEFAULT_BUCKETS,
                  ):
         self._prepare_buckets(buckets)
@@ -519,7 +527,7 @@
             subsystem=subsystem,
             unit=unit,
             registry=registry,
-            labelvalues=labelvalues,
+            _labelvalues=_labelvalues,
         )
         self._kwargs['buckets'] = buckets
 
@@ -550,7 +558,15 @@
             )
 
     def observe(self, amount):
-        """Observe the given amount."""
+        """Observe the given amount.
+
+        The amount is usually positive or zero. Negative values are
+        accepted but prevent current versions of Prometheus from
+        properly detecting counter resets in the sum of
+        observations. See
+        
https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations
+        for details.
+        """
         self._sum.inc(amount)
         for i, bound in enumerate(self._upper_bounds):
             if amount <= bound:
@@ -636,7 +652,7 @@
                  subsystem='',
                  unit='',
                  registry=REGISTRY,
-                 labelvalues=None,
+                 _labelvalues=None,
                  states=None,
                  ):
         super(Enum, self).__init__(
@@ -647,7 +663,7 @@
             subsystem=subsystem,
             unit=unit,
             registry=registry,
-            labelvalues=labelvalues,
+            _labelvalues=_labelvalues,
         )
         if name in labelnames:
             raise ValueError('Overlapping labels for Enum metric: %s' % 
(name,))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.10.1/setup.py 
new/client_python-0.11.0/setup.py
--- old/client_python-0.10.1/setup.py   2021-04-08 18:30:13.000000000 +0200
+++ new/client_python-0.11.0/setup.py   2021-06-01 19:19:33.000000000 +0200
@@ -12,7 +12,7 @@
 
 setup(
     name="prometheus_client",
-    version="0.10.1",
+    version="0.11.0",
     author="Brian Brazil",
     author_email="brian.bra...@robustperception.io",
     description="Python client for the Prometheus monitoring system.",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/client_python-0.10.1/tox.ini 
new/client_python-0.11.0/tox.ini
--- old/client_python-0.10.1/tox.ini    2021-04-08 18:30:13.000000000 +0200
+++ new/client_python-0.11.0/tox.ini    2021-06-01 19:19:33.000000000 +0200
@@ -6,6 +6,8 @@
 deps =
     coverage
     pytest
+; Python 3.4 fails if using 21.1.0.
+    attrs!=21.1.0
 
 [testenv:py2.7]
 deps =

Reply via email to