Skip to content

Commit 3c96c79

Browse files
shughes-ukGreyZmeem
authored andcommitted
format_microsecond to avoid precision loss (#2)
1 parent 2224795 commit 3c96c79

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

logging_loki/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def emit(self, record: logging.LogRecord):
6464
# noinspection PyBroadException
6565
try:
6666
labels = self.build_labels(record)
67-
ts = rfc3339.format(record.created)
67+
ts = rfc3339.format_microsecond(record.created)
6868
line = self.format(record)
6969
payload = {"streams": [{"labels": labels, "entries": [{"ts": ts, "line": line}]}]}
7070
resp = self.session.post(self.url, json=payload)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
url="https://github.com/greyzmeem/python-logging-loki",
1616
packages=setuptools.find_packages(),
1717
python_requires=">=3.5",
18-
install_requires=["rfc3339", "requests"],
18+
install_requires=["rfc3339>=6.1", "requests"],
1919
classifiers=[
2020
"Development Status :: 4 - Beta",
2121
"Intended Audience :: Developers",

0 commit comments

Comments
 (0)