diff --git a/deployment_scripts/puppet/modules/telemetry/files/common/resources.lua b/deployment_scripts/puppet/modules/telemetry/files/common/resources.lua index 465585b..f70cb1f 100644 --- a/deployment_scripts/puppet/modules/telemetry/files/common/resources.lua +++ b/deployment_scripts/puppet/modules/telemetry/files/common/resources.lua @@ -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,