Merge "Convert resource timestamps to RFC3339 format for ES"
This commit is contained in:
commit
66cecd7f08
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
local cjson = cjson
|
local cjson = cjson
|
||||||
local string = string
|
local string = string
|
||||||
local table = table
|
|
||||||
local math = math
|
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
@ -31,7 +29,6 @@ function normalize_uuid(uuid)
|
||||||
return patt.Uuid:match(uuid)
|
return patt.Uuid:match(uuid)
|
||||||
end
|
end
|
||||||
|
|
||||||
local metadata_fields = {}
|
|
||||||
|
|
||||||
local ResourcesDecoder = {}
|
local ResourcesDecoder = {}
|
||||||
ResourcesDecoder.__index = ResourcesDecoder
|
ResourcesDecoder.__index = ResourcesDecoder
|
||||||
|
@ -70,8 +67,18 @@ local resource_msg = {
|
||||||
function add_resource_to_payload(sample, payload)
|
function add_resource_to_payload(sample, payload)
|
||||||
local counter_name, _ = string.gsub(sample.counter_name, "%.", "\\")
|
local counter_name, _ = string.gsub(sample.counter_name, "%.", "\\")
|
||||||
|
|
||||||
|
local metadata = sample.resource_metadata
|
||||||
|
if type(metadata) == 'table' then
|
||||||
|
for name, value in ipairs(metadata) do
|
||||||
|
local transform = transform_functions[name]
|
||||||
|
if transform ~= nil then
|
||||||
|
metadata[name] = transform(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local resource_data = {
|
local resource_data = {
|
||||||
timestamp = sample.timestamp,
|
timestamp = utils.format_datetime(sample.timestamp),
|
||||||
resource_id = sample.resource_id,
|
resource_id = sample.resource_id,
|
||||||
source = sample.source or "",
|
source = sample.source or "",
|
||||||
metadata = sample.resource_metadata,
|
metadata = sample.resource_metadata,
|
||||||
|
|
Loading…
Reference in New Issue