client_python icon indicating copy to clipboard operation
client_python copied to clipboard

prometheus_client.generate_latest()

Open GeluConstantin opened this issue 2 years ago • 1 comments

Hi,

I use this method in combination with fastAPI in order to expose metrics over the API. The data come from a JSON file saved on Linux system (where the service runs).

When changing the values in the file in order to create metrics the metric value does not change, only when restarting the web server (Uvicorn).

Why are the changed values not recalculated?

For opening the file I use the standard command with open('filename.json', mode = 'r') as f:

Thank you in advance for the feedback!

GeluConstantin avatar Dec 12 '23 12:12 GeluConstantin

Would you be able to provide more details? If you are not re-reading (and possibly re-opening) the file on each request I can imagine the file in the Python process not being updated.

csmarchbanks avatar Jan 25 '24 20:01 csmarchbanks