-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix use multi process for load metrics #429
base: master
Are you sure you want to change the base?
Fix use multi process for load metrics #429
Conversation
TBH, I don't think this PR is a good idea. the function you modified is (IMHO, since I didn't originally write this code) is more of a reference code. swallowing exception in this way, is really bad idea. |
Hi, Thank you for your response. I agree with handling the exception this way, so I removed the However, I'm sure this code: prometheus_client.start_http_server(port, addr=addr) won't work with registry = prometheus_client.CollectorRegistry() to prometheus_client.start_http_server(port, addr=addr, registry=registry) When we set Here are the steps to reproduce the bug:
Thank you for your attention. Please tell me if I am wrong about anything. |
Hi, I hope you’re doing well. I added a pull request 3 weeks ago. Could you spare some moment to review it? I’d really appreciate it. |
Hi,
I opened a pull request (#407) that was closed. I think I need to explain the problem in more detail.
The first problem is with using the
PROMETHEUS_METRICS_EXPORT_PORT
andPROMETHEUS_METRICS_EXPORT_ADDRESS
environment variables. Here is the command that starts my app:The first error we encounter is
Address already in use
because inexports.py
, line 45, the functionprometheus_client.start_http_server(port, addr=addr)
is called without checking if the port is already in use. This should be handled with atry-except
block.The second problem is when we use the
PROMETHEUS_MULTIPROC_DIR
environment variable. The functionSetupPrometheusEndpointOnPort
does not checkPROMETHEUS_MULTIPROC_DIR
and only runs this:The implementation of this part must be similar to
ExportToDjangoView
. I mistakenly forced the app to usePROMETHEUS_MULTIPROC_DIR
, but I have fixed it.Thank you for your attention. Please tell me where I am wrong about it.