From c211e69ef7762051847dce1f95320b31fa31a180 Mon Sep 17 00:00:00 2001 From: antialiasis Date: Wed, 8 Feb 2017 12:17:58 +0000 Subject: [PATCH 1/2] Fix documentation of labels method to pass keyword arguments instead of a dict. --- prometheus_client/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prometheus_client/core.py b/prometheus_client/core.py index 8b975c82..30cd4e1e 100644 --- a/prometheus_client/core.py +++ b/prometheus_client/core.py @@ -471,13 +471,13 @@ def labels(self, *labelvalues, **labelkwargs): c.labels('get', '/').inc() c.labels('post', '/submit').inc() - Labels can also be provided as a dict: + Labels can also be provided as keyword arguments: from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) - c.labels({'method': 'get', 'endpoint': '/'}).inc() - c.labels({'method': 'post', 'endpoint': '/submit'}).inc() + c.labels(method='get', endpoint='/').inc() + c.labels(method='post', endpoint='/submit').inc() See the best practices on [naming](http://prometheus.io/docs/practices/naming/) and [labels](http://prometheus.io/docs/practices/instrumentation/#use-labels). From 0873f8270b831747c5346a2b4f907cdc2bb54fcd Mon Sep 17 00:00:00 2001 From: antialiasis Date: Wed, 8 Feb 2017 13:31:01 +0000 Subject: [PATCH 2/2] Ignore ValueErrors (prometheus/client_python#80). --- prometheus_client/process_collector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus_client/process_collector.py b/prometheus_client/process_collector.py index b6e75cbc..73c53efb 100644 --- a/prometheus_client/process_collector.py +++ b/prometheus_client/process_collector.py @@ -83,7 +83,7 @@ def collect(self): 'Number of open file descriptors.', len(os.listdir(os.path.join(pid, 'fd')))) result.extend([open_fds, max_fds]) - except IOError: + except (IOError, ValueError): pass return result