Change "us" time precision in lma_utils to "u"
InfluxDB expects "u" precision for microseconds, but lma_utils
uses a "us" precision for it. In this patch I sync these precision names,
because otherwise influxdb output writes records with
invalid time to InfluxDB.
Change-Id: I0bf50c6f80faa4bc434a4a7efc01113dd7869dae
diff --git a/heka/files/lua/common/influxdb.lua b/heka/files/lua/common/influxdb.lua
index 9341399..889c1a0 100644
--- a/heka/files/lua/common/influxdb.lua
+++ b/heka/files/lua/common/influxdb.lua
@@ -67,7 +67,7 @@
-- Create a new InfluxDB encoder
--
--- time_precision: "s", "m", "ms", "us" or "ns" (default: "ns")
+-- time_precision: "s", "m", "ms", "u" or "ns" (default: "ns")
function InfluxEncoder.new(time_precision)
local e = {}
setmetatable(e, InfluxEncoder)
diff --git a/heka/files/lua/common/lma_utils.lua b/heka/files/lua/common/lma_utils.lua
index 0ceeff6..7488ba4 100644
--- a/heka/files/lua/common/lma_utils.lua
+++ b/heka/files/lua/common/lma_utils.lua
@@ -265,7 +265,7 @@
-- Convert a nanosecond timestamp to a lower precision timestamp.
-- Arguments:
--- timestamp_precision: one of 'us', 'ms', 's', 'm' or 'h'.
+-- timestamp_precision: one of 'u', 'ms', 's', 'm' or 'h'.
-- timestamp: a timestamp in nanosecond, if not provided the message Timestamp is used.
function message_timestamp(timestamp_precision, timestamp)
-- Default is to divide ns to ms
@@ -274,7 +274,7 @@
if timestamp_precision == "s" then
timestamp_divisor = 1e9
-- Divide ns to us
- elseif timestamp_precision == "us" then
+ elseif timestamp_precision == "u" then
timestamp_divisor = 1e3
-- Divide ns to m
elseif timestamp_precision == "m" then