-
Notifications
You must be signed in to change notification settings - Fork 810
Add ability to turn off _created metrics #672
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
Comments
Any update on this?
Thanks. |
Hello, no progress has been made but I would be happy to accept a contribution to provide a flag. |
May be I don't understand this feature clearly, but seems like it doesn't work as expected. I created few metrics in my Python+FastAPI+Gunicorn application
And then I added
|
Did you set |
Yes, I did. I even tried set the variable before import |
Any updates on this? @csmarchbanks Sorry for mentioning |
I haven't had time yet, I am hoping to try to reproduce today, but it might have to wait until next week. |
I was using this flag for some time, and sometimes it does not work, even if I set it in-process before importing So, I hacked and just set internal variable: #!/usr/bin/env python3
# ...
import os
# ...
os.environ["PROMETHEUS_DISABLE_CREATED_SERIES"] = "True"
import prometheus_client
prometheus_client.metrics._use_created = False
... |
Yeah, we need to make that variable settable in code. See #933. |
I'll try @baryluk hack for now. But hope you figure out how to solve the issue in better way. May be reopen the issue? |
I spent a bit of time trying to reproduce this, and if I set the environment variable before running the script it seems to consistently work. My guess is that setting the environment variable isn't being propagated to child processes, similar to if you try to set PROMETHEUS_MULTIPROC_DIR inside of python. The readme calls this out in multiprocess mode, but maybe we should explicitly call it out for PROMETHEUS_DISABLE_CREATED_SERIES too? Also, if you are using multi-process mode I don't think this issue should be reopened, the work for disabling |
That is interesting, because I do not use child subprocesses. I do use some threading, but not subprocesses. And if I do use subprocesses, this is to run non-python auxilary programs ( Not sure why setting env before program start, and modying it in the main thread, before starting any other sub-processes, should have any differences. Maybe |
As per the June 24th 2021 Prometheus Dev Summit there is consensus that all first party clients should have a parameter to turn off _created metrics.
The text was updated successfully, but these errors were encountered: