Closed FelipeLahti closed 1 month ago
Workaround: Spin up a thread to flush it every 30s. It could be add as built in into the lib if that makes sense.
client = axiom_py.Client()
handler = AxiomHandler(client, "my-dataset")
def flush_handler_periodically():
while True:
handler.flush()
time.sleep(30)
thread = threading.Thread(target=flush_handler_periodically)
thread.daemon = True
thread.start()
logging.getLogger().addHandler(handler)
Hi @FelipeLahti, thanks! You’re right, we should fix this. Another option would be using a threading.Timer
to flush logs at least every second—similarly to how we handle this situation in axiom-js. Will keep his open until that‘s implemented 😌
Fixed in https://github.com/axiomhq/axiom-py/pull/140, will be in the next release
@bahlo Could we implement the same for structlog? Should I raise a PR with a similar change to the structlog
module?
Issue
Logs aren't propagating to axiom.
How to reproduce:
Possible solution: