nvanheuverzwijn / monolog-logdna

GNU Lesser General Public License v3.0
21 stars 21 forks source link

Send logdna now argument in milliseconds #23

Closed slepic closed 9 months ago

slepic commented 9 months ago

As discussedi in #21 this implementation takes the now value from system time and sends it to logdna in milliseonds as per documentation (https://docs.mezmo.com/log-analysis-api#ingest)

I also added the possibility to turn the time drift calculation off by not sending the now parameter

$handler->setIncludeRequestTime(false);
slepic commented 9 months ago

I was originally concerned that floating point arithmetics might not be suitable here, but

  1. I couldn't find any particular timestamp for which it would break (well i didnt try all the trillions of them...)
  2. According to wiki - double precision floating point format numbers should grant 15-17 significant digits. The current timestamp in milliseconds needs 13 and we have about 263 years until 14th digit is needed.
  3. single precision floating point numbers however have only 6-9 significant digits. This would only apply on machines that do not implement double precision floating point arithmetics in their CPU and I'm totally fine ignoring that possibility these days.