Where is python's fluentd??

from fluent import sender
from fluent import event

sender.setup("tag")
event.Event("label", data)

There were many articles doing like this. I felt uncomfortable, so when I actually looked at the implementation, I used global variables! (Use a global variable called _global_sender in the setup method-> in init of Event, call global_sender.emit_with_name and pass the current time to timestamp)

so

from fluent import sender
import time

send = sender.FluentSender("tag", host="localhost", port=24224)
send.emit_with_time("label", int(time.time()), data)

It's safe

Recommended Posts

Where is python's fluentd??
What is Python's __init__.py?
Is Python's Object Orientation Retrofit?
Why is Python's logging library camelCase?
Is Python's static scope messed up?
Python's GzipFile class is read via BufferedReader
Where is the python instantiation process written?
Is Python's in operator slow? (From ABC167D)
Where can I find Python's GPG Key?