c2cwsgiutils 6.1.7.dev4__py3-none-any.whl → 6.1.7.dev6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  """Every thing we needs to have the metrics in Prometheus."""
2
2
 
3
+ import logging
3
4
  import os
4
5
  import re
5
6
  from collections.abc import Generator, Iterable
@@ -11,10 +12,12 @@ import prometheus_client.metrics_core
11
12
  import prometheus_client.multiprocess
12
13
  import prometheus_client.registry
13
14
  import pyramid.config
15
+ import redis.exceptions
14
16
 
15
17
  from c2cwsgiutils import broadcast, redis_utils
16
18
  from c2cwsgiutils.debug.utils import dump_memory_maps
17
19
 
20
+ _LOG = logging.getLogger(__name__)
18
21
  _NUMBER_RE = re.compile(r"^[0-9]+$")
19
22
  MULTI_PROCESS_COLLECTOR_BROADCAST_CHANNELS = [
20
23
  "c2cwsgiutils_prometheus_collector_gc",
@@ -117,9 +120,12 @@ class MultiProcessCustomCollector(prometheus_client.registry.Collector):
117
120
  def collect(self) -> Generator[prometheus_client.core.Metric, None, None]:
118
121
  results: list[list[SerializedMetric]] = []
119
122
  for channel in MULTI_PROCESS_COLLECTOR_BROADCAST_CHANNELS:
120
- result = broadcast.broadcast(channel, expect_answers=True)
121
- if result is not None:
122
- results.extend(cast(Iterable[list[SerializedMetric]], result))
123
+ try:
124
+ result = broadcast.broadcast(channel, expect_answers=True)
125
+ if result is not None:
126
+ results.extend(cast(Iterable[list[SerializedMetric]], result))
127
+ except redis.exceptions.ConnectionError:
128
+ _LOG.error("Failed to get the metrics from the other processes")
123
129
  return _deserialize_collected_data(results)
124
130
 
125
131
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cwsgiutils
3
- Version: 6.1.7.dev4
3
+ Version: 6.1.7.dev6
4
4
  Summary: Common utilities for Camptocamp WSGI applications
5
5
  Home-page: https://github.com/camptocamp/c2cwsgiutils
6
6
  License: BSD-2-Clause
@@ -30,7 +30,7 @@ c2cwsgiutils/logging_view.py,sha256=d0UkvYRGkVUMY9_vbjEzXmm8-6CCec2B43a3mJAqWyw,
30
30
  c2cwsgiutils/models_graph.py,sha256=q5dW_gZ5iUZCzBya5Kpy57y9oqsG-rGi9AvrXCDgYqs,2679
31
31
  c2cwsgiutils/pretty_json.py,sha256=WQlgNVeWPD_QMEjkNq5rFVGdFwQ7xDyICf0uxj0Hu2U,1697
32
32
  c2cwsgiutils/profiler.py,sha256=3tIwoDSzOKQ06ug_U6j5VDR1BQ9auUOqdJRRLRhDoHw,739
33
- c2cwsgiutils/prometheus.py,sha256=XV_SSm0nT09MD8EEl2a4xtd2busO3r--JyboU9OvWaQ,6576
33
+ c2cwsgiutils/prometheus.py,sha256=5oNG9UzTxiyE_UdLV70PuPs-NqrvLWfvdYb82KC0JT8,6813
34
34
  c2cwsgiutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  c2cwsgiutils/pyramid.py,sha256=MnVMskHMlJ4KQDjDR7CQdYaH70YXOtJ-1ThTPBqa03c,1387
36
36
  c2cwsgiutils/pyramid_logging.py,sha256=M4XtWQZStreEoyC5qlwxcDDKCp4PZOr9SN05GnaYvvA,3732
@@ -60,8 +60,8 @@ c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=A61t6VKIrRRIjbyZTldmAUl_Q3ZDVFYqyxj
60
60
  c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=mRiOmQXV9x8JjkGV4MsaC7sD3qO6dWUTog0bharLLD0,3517
61
61
  c2cwsgiutils/templates/index.html.mako,sha256=cK8qGBDeQG5SiJJCfvL0oKpgacr7dPKx634AAQivmjA,1416
62
62
  c2cwsgiutils/version.py,sha256=1ghPu-aKMJdfCSUrxgBENNqNQ-7JMKJr6tS14dDmW4Q,3110
63
- c2cwsgiutils-6.1.7.dev4.dist-info/LICENSE,sha256=6bEOU0n7ued3SA-DQCsHQaACONMMRzGHmH5XhDVeD-U,1304
64
- c2cwsgiutils-6.1.7.dev4.dist-info/METADATA,sha256=bNxv5REJhQ1RiSYrsuk-h7s28UfeJTZIIuoFWUXfHO0,34401
65
- c2cwsgiutils-6.1.7.dev4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
- c2cwsgiutils-6.1.7.dev4.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
- c2cwsgiutils-6.1.7.dev4.dist-info/RECORD,,
63
+ c2cwsgiutils-6.1.7.dev6.dist-info/LICENSE,sha256=6bEOU0n7ued3SA-DQCsHQaACONMMRzGHmH5XhDVeD-U,1304
64
+ c2cwsgiutils-6.1.7.dev6.dist-info/METADATA,sha256=7MLIL3I-kk17gELSjMSWgBpO__OlOKb99rMzWVwCqZ8,34401
65
+ c2cwsgiutils-6.1.7.dev6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
+ c2cwsgiutils-6.1.7.dev6.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
+ c2cwsgiutils-6.1.7.dev6.dist-info/RECORD,,