spandex-project/spandex

Question: Which time unit to use in spans?

Closed this issue · 1 comments

spandex_ecto seems to be sending to datadog the measurements in nanoseconds https://github.com/spandex-project/spandex_ecto/blob/master/lib/spandex_ecto/ecto_logger.ex#L114.

There a pattern or a preferred unit for the measurements?

According to the Datadog API docs, the start timestamp should have nanosecond granularity, and the duration should also have nanosecond granularity. My guess is that this is so that it's possible to represent durations like 1.25 µs.

Note that this usage in SpandexEcto is specifically about representing the start and duration fields on each of the spans that it generates to represent the DB operation, and not the arbitrary tags that you might put on them or the time-series metrics you might send to Datadog using another library via the Statsd protocol. Those would be up to you to choose the granularity that you want.