Remove empty fields from resource metadata
Change-Id: I6d8b1678e2e26e541d41d5894890cad57f4488a8
This commit is contained in:
parent
5494211a42
commit
0b9de5bc89
|
@ -68,11 +68,16 @@ 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
|
||||
metadata[name] = transform(value)
|
||||
value = transform(value)
|
||||
end
|
||||
local_metadata[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -81,7 +86,7 @@ function add_resource_to_payload(sample, payload)
|
|||
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 = {
|
||||
|
|
Loading…
Reference in New Issue