c2cwsgiutils 6.0.0.dev88__py3-none-any.whl → 6.0.0.dev93__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.
- c2cwsgiutils/prometheus.py +3 -3
- c2cwsgiutils/scripts/stats_db.py +3 -3
- c2cwsgiutils/version.py +1 -1
- {c2cwsgiutils-6.0.0.dev88.dist-info → c2cwsgiutils-6.0.0.dev93.dist-info}/METADATA +4 -4
- {c2cwsgiutils-6.0.0.dev88.dist-info → c2cwsgiutils-6.0.0.dev93.dist-info}/RECORD +8 -8
- {c2cwsgiutils-6.0.0.dev88.dist-info → c2cwsgiutils-6.0.0.dev93.dist-info}/LICENSE +0 -0
- {c2cwsgiutils-6.0.0.dev88.dist-info → c2cwsgiutils-6.0.0.dev93.dist-info}/WHEEL +0 -0
- {c2cwsgiutils-6.0.0.dev88.dist-info → c2cwsgiutils-6.0.0.dev93.dist-info}/entry_points.txt +0 -0
c2cwsgiutils/prometheus.py
CHANGED
@@ -24,7 +24,7 @@ MULTI_PROCESS_COLLECTOR_BROADCAST_CHANNELS = [
|
|
24
24
|
def start(registry: Optional[prometheus_client.CollectorRegistry] = None) -> None:
|
25
25
|
"""Start separate HTTP server to provide the Prometheus metrics."""
|
26
26
|
|
27
|
-
if os.environ.get("
|
27
|
+
if os.environ.get("C2C_PROMETHEUS_PORT") is not None:
|
28
28
|
broadcast.includeme()
|
29
29
|
|
30
30
|
registry = prometheus_client.CollectorRegistry() if registry is None else registry
|
@@ -32,7 +32,7 @@ def start(registry: Optional[prometheus_client.CollectorRegistry] = None) -> Non
|
|
32
32
|
registry.register(prometheus_client.PLATFORM_COLLECTOR)
|
33
33
|
registry.register(MultiProcessCustomCollector())
|
34
34
|
prometheus_client.multiprocess.MultiProcessCollector(registry) # type: ignore[no-untyped-call]
|
35
|
-
prometheus_client.start_http_server(int(os.environ["
|
35
|
+
prometheus_client.start_http_server(int(os.environ["C2C_PROMETHEUS_PORT"]), registry=registry)
|
36
36
|
|
37
37
|
|
38
38
|
def includeme(config: pyramid.config.Configurator) -> None:
|
@@ -45,7 +45,7 @@ def includeme(config: pyramid.config.Configurator) -> None:
|
|
45
45
|
def build_metric_name(postfix: str) -> str:
|
46
46
|
"""Build the metric name with the prefix from the environment variable."""
|
47
47
|
|
48
|
-
return os.environ.get("
|
48
|
+
return os.environ.get("C2C_PROMETHEUS_PREFIX", "c2cwsgiutils_") + postfix
|
49
49
|
|
50
50
|
|
51
51
|
def cleanup() -> None:
|
c2cwsgiutils/scripts/stats_db.py
CHANGED
@@ -92,10 +92,10 @@ class Reporter:
|
|
92
92
|
if self.prometheus_push:
|
93
93
|
push_to_gateway(self.args.prometheus_url, job="db_counts", registry=self.registry)
|
94
94
|
else:
|
95
|
-
port = int(os.environ.get("
|
95
|
+
port = int(os.environ.get("C2C_PROMETHEUS_PORT", "9090"))
|
96
96
|
app = make_wsgi_app(self.registry)
|
97
97
|
with make_server("", port, app) as httpd:
|
98
|
-
|
98
|
+
LOG.info("Waiting that Prometheus get the metrics served on port %s...", port)
|
99
99
|
httpd.handle_request()
|
100
100
|
|
101
101
|
def error(self, metric: List[str], error_: Exception) -> None:
|
@@ -288,7 +288,7 @@ def main() -> None:
|
|
288
288
|
"""Run the command."""
|
289
289
|
success = False
|
290
290
|
args = _parse_args()
|
291
|
-
c2cwsgiutils.setup_process.
|
291
|
+
c2cwsgiutils.setup_process.init(args.config_uri)
|
292
292
|
for _ in range(int(os.environ.get("C2CWSGIUTILS_STATS_DB_TRYNUMBER", 10))):
|
293
293
|
try:
|
294
294
|
_do_dtats_db(args)
|
c2cwsgiutils/version.py
CHANGED
@@ -14,7 +14,7 @@ _VERSIONS_PATH = "/app/versions.json"
|
|
14
14
|
_LOG = logging.getLogger(__name__)
|
15
15
|
|
16
16
|
_PACKAGES = os.environ.get("C2C_PROMETHEUS_PACKAGES", "c2cwsgiutils,pyramid,gunicorn,sqlalchemy").split(",")
|
17
|
-
_APPLICATION_PACKAGES = os.environ.get("
|
17
|
+
_APPLICATION_PACKAGES = os.environ.get("C2C_PROMETHEUS_APPLICATION_PACKAGE")
|
18
18
|
_LABEL_RE_NOT_ALLOWED = re.compile(r"[^a-zA-Z0-9]+")
|
19
19
|
|
20
20
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: c2cwsgiutils
|
3
|
-
Version: 6.0.0.
|
3
|
+
Version: 6.0.0.dev93
|
4
4
|
Summary: Common utilities for Camptocamp WSGI applications
|
5
5
|
Home-page: https://github.com/camptocamp/c2cwsgiutils
|
6
6
|
License: BSD-2-Clause
|
@@ -483,14 +483,14 @@ command line. Usually done in the [Dockerfile](acceptance_tests/app/Dockerfile)
|
|
483
483
|
It will work in multi process mode with the limitation listed in the
|
484
484
|
[`prometheus_client` documentation](https://github.com/prometheus/client_python#multiprocess-mode-eg-gunicorn).
|
485
485
|
|
486
|
-
To enable it you should provide the `
|
486
|
+
To enable it you should provide the `C2CWSGIUTILS_PROMETHEUS_PORT` environment variable.
|
487
487
|
For security reason, this port should not be exposed.
|
488
488
|
|
489
489
|
We can customize it with the following environment variables:
|
490
490
|
|
491
|
-
- `
|
491
|
+
- `C2C_PROMETHEUS_PREFIX`: to customize the prefix, default is `c2cwsggiutils-`.
|
492
492
|
- `C2C_PROMETHEUS_PACKAGES` the packages that will be present in the version information, default is `c2cwsgiutils,pyramid,gunicorn,sqlalchemy`.
|
493
|
-
- `
|
493
|
+
- `C2C_PROMETHEUS_APPLICATION_PACKAGE` the packages that will be present in the version information as application.
|
494
494
|
|
495
495
|
And you should add in your `gunicorn.conf.py`:
|
496
496
|
|
@@ -28,7 +28,7 @@ c2cwsgiutils/logging_view.py,sha256=zVvZiNvJDdMwclm3KiqsfK8Ra2JSKPSSQt5VYGGpQ2k,
|
|
28
28
|
c2cwsgiutils/models_graph.py,sha256=z-sfSssKR89W-X3JQvAEdfiAyl-vxkSLo-hs7PcfOUI,2691
|
29
29
|
c2cwsgiutils/pretty_json.py,sha256=f1-oecFX9hub1nD32mmZRjOTIxhV8bVSt3Meqw68sNU,1698
|
30
30
|
c2cwsgiutils/profiler.py,sha256=3tIwoDSzOKQ06ug_U6j5VDR1BQ9auUOqdJRRLRhDoHw,739
|
31
|
-
c2cwsgiutils/prometheus.py,sha256=
|
31
|
+
c2cwsgiutils/prometheus.py,sha256=uXvKAKxt24zL0Umar_twuWIC57PcqqHdwJ4dO-ZXoKs,6599
|
32
32
|
c2cwsgiutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
c2cwsgiutils/pyramid.py,sha256=H-b5abZvxt9MkMFjyWOjWzPa02YRhZR6LDiMCaYLq5s,1388
|
34
34
|
c2cwsgiutils/pyramid_logging.py,sha256=BfxYbpF7mxjMY_08TGp3I9101e6s8tUSJ5yKN7tAt9o,3703
|
@@ -38,7 +38,7 @@ c2cwsgiutils/request_tracking/__init__.py,sha256=TT_x11kbCbnp7qmeWsNOoe1g9vfJiBu
|
|
38
38
|
c2cwsgiutils/request_tracking/_sql.py,sha256=ME13tdXV2Vvhvscon9DbDUqehNWcn4uL75uqzcN5-Mg,577
|
39
39
|
c2cwsgiutils/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
c2cwsgiutils/scripts/genversion.py,sha256=A5jE3E-yNMd3IW4jRFJmvLHphrvko4rA-is43sFKoxw,1998
|
41
|
-
c2cwsgiutils/scripts/stats_db.py,sha256=
|
41
|
+
c2cwsgiutils/scripts/stats_db.py,sha256=gVmw6tcXpNkYIweT9SLNpM_N1ZILMstEhmSmawZEmV4,10445
|
42
42
|
c2cwsgiutils/scripts/test_print.py,sha256=UeOZa7jTazgEq5BRJD6lq-u9K6G4movf-sOVKTEs1cQ,2096
|
43
43
|
c2cwsgiutils/sentry.py,sha256=SpqCADxHvYVR89mFRMQDA7IbUVHh6iwKS06keWXtZSQ,5002
|
44
44
|
c2cwsgiutils/services.py,sha256=qz51oCZOC0Lj2_ig4UuHIm0ZZO3FfpFTxrXBWZ_oaNo,1567
|
@@ -54,9 +54,9 @@ c2cwsgiutils/sqlalchemylogger/handlers.py,sha256=NG9U5alNKbViYfde0-HlSQvrHEzLUgp
|
|
54
54
|
c2cwsgiutils/stats_pyramid/__init__.py,sha256=7P10LjLv3c-ObEDGuYmRF_RFt7fRmO80ruqTGQAyC6w,747
|
55
55
|
c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=ZGRdrI17Bdl3mzaLjfPyAaEW3KK8Pikrgi-0WmH7zCs,2917
|
56
56
|
c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=P212MGGl2VV_7UU4AXZA-rOuF7ouaONRklZwpas2wc8,3209
|
57
|
-
c2cwsgiutils/version.py,sha256
|
58
|
-
c2cwsgiutils-6.0.0.
|
59
|
-
c2cwsgiutils-6.0.0.
|
60
|
-
c2cwsgiutils-6.0.0.
|
61
|
-
c2cwsgiutils-6.0.0.
|
62
|
-
c2cwsgiutils-6.0.0.
|
57
|
+
c2cwsgiutils/version.py,sha256=kSva7UIAwgHqofb-HuqP_z0pU8B0owf_jRpJWGhl7qc,2876
|
58
|
+
c2cwsgiutils-6.0.0.dev93.dist-info/LICENSE,sha256=rM6IWxociA3daRkXnNLYOxGndT5fbs3BfVZCA2Xgt-g,1304
|
59
|
+
c2cwsgiutils-6.0.0.dev93.dist-info/METADATA,sha256=FiRT9btW8-8FzSIosWM0x3mSgpMNn_qhiZVcwoFQy5g,31984
|
60
|
+
c2cwsgiutils-6.0.0.dev93.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
61
|
+
c2cwsgiutils-6.0.0.dev93.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
|
62
|
+
c2cwsgiutils-6.0.0.dev93.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|