Merge "Convert resource timestamps to RFC3339 format for ES"

This commit is contained in:
Jenkins 2017-02-13 09:05:56 +00:00 committed by Gerrit Code Review
commit 66cecd7f08
1 changed files with 11 additions and 4 deletions

View File

@ -14,8 +14,6 @@
local cjson = cjson
local string = string
local table = table
local math = math
local setmetatable = setmetatable
local ipairs = ipairs
local pairs = pairs
@ -31,7 +29,6 @@ function normalize_uuid(uuid)
return patt.Uuid:match(uuid)
end
local metadata_fields = {}
local ResourcesDecoder = {}
ResourcesDecoder.__index = ResourcesDecoder
@ -70,8 +67,18 @@ local resource_msg = {
function add_resource_to_payload(sample, payload)
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 = {
timestamp = sample.timestamp,
timestamp = utils.format_datetime(sample.timestamp),
resource_id = sample.resource_id,
source = sample.source or "",
metadata = sample.resource_metadata,