python-logging-loki
python-logging-loki copied to clipboard
V1 timestamp
Should the V1 emitter timestamp be retrieved from record.created, just like it used to be in V0?
This is how it was set for a V0 record and there seems to be no reason why this shouldn't also apply to V1. The divergence makes a migration more difficult due to the inconsistent handling.
Suggestion for change:
ts = rfc3339.format_microsecond(record.created)
Happy to submit a pull request with the change, if contributors and @GreyZmeem agree.
I actually changed that line to:
ts = str(time.time_ns())
v1 expects nanoseconds and that is now a builtin function since Python 3.7
https://docs.python.org/3.7/library/time.html#time.time_ns