Prometheus middleware improvements#627
Conversation
|
I’m traveling right now and won’t be able to do a full review for a few weeks, but the casing of the environment variables should remain unchanged, otherwise this would be a breaking change. |
|
Do you think it would be acceptable to use uppercase And what's your opinion on And I'll try to look at gevent tests. Slightly off-topic, but is tox config up-to-date? I've been having trouble trying to run tox - errors out on tests with something about "conflicting factors". |
Let’s use fallbacks for both environment vars. The tox config is probably out of date at the moment since it’s no longer used in CI. |
A number of Prometheus middleware improvements:
Have successfully run
pytest --benchmark-skipon my local python 3.10.14.Some details below.
Canonical queue names
If queue names aren't canonical, then something like this happens to metrics:
Unique PROMETHEUS_MULTIPROC_DIR
Previously, Prometheus mutli-proc exporting would interfere between multiple Dramatiq instances on the same machine (because the prom DB path would be the same across different instances). Actually, would interfere even across restarts of the same Dramatiq instance (and even in containerized environments, when containers are just restarted, and not recreated).
In containerized env, top-level PID value is likely to be the same across runs, but with auto-cleanup it can be managed.
Metrics test
Noticed that
test_prometheus_middleware_exposes_metricswas sometimes failing due to timings - metrics endpoint wasn't ready in 1 second. Should be a bit more stable now.