I have a script that is extracting data from an internal service and storing the count of data types in memory like this:
metrics = { \"new_accounts\": 15
Try to put Your metric to Queue:
https://docs.python.org/2/library/queue.html
Flask endpoint can read all data from Queue, and expose last value as endpoint data
Cheers, Fenrir