Merge "Remove unused Lua file"
diff --git a/heka/files/lua/common/resources.lua b/heka/files/lua/common/resources.lua
index e33264e..dc18329 100644
--- a/heka/files/lua/common/resources.lua
+++ b/heka/files/lua/common/resources.lua
@@ -31,8 +31,6 @@
return patt.Uuid:match(uuid)
end
-local metadata_fields = {}
-
local ResourcesDecoder = {}
ResourcesDecoder.__index = ResourcesDecoder
@@ -70,11 +68,26 @@
function add_resource_to_payload(sample, payload)
local counter_name, _ = string.gsub(sample.counter_name, "%.", "\\")
+ local metadata = sample.resource_metadata
+ local local_metadata = {}
+
+ if type(metadata) == 'table' then
+ for name, value in ipairs(metadata) do
+ local transform = transform_functions[name]
+ if value ~= '' and value ~= nil then
+ if transform ~= nil then
+ value = transform(value)
+ end
+ local_metadata[name] = 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,
+ metadata = local_metadata,
user_id = sample.user_id,
project_id = sample.project_id,
meter = {
diff --git a/heka/files/lua/decoders/collectd.lua b/heka/files/lua/decoders/collectd.lua
index 8647cd8..9c1ff31 100644
--- a/heka/files/lua/decoders/collectd.lua
+++ b/heka/files/lua/decoders/collectd.lua
@@ -463,10 +463,10 @@
-- check if the hostname field should be kept or not (eg for
-- cluster metrics, discard_hostname == true)
- if sample['meta']['discard_hostname'] then
+ if sample['meta'] and sample['meta']['discard_hostname'] then
msg['Fields']['hostname'] = nil
+ sample['meta']['discard_hostname'] = nil
end
- sample['meta']['discard_hostname'] = nil
-- add meta fields as tag_fields
for k, v in pairs(sample['meta'] or {}) do