Merge pull request #112 from ityaptin/master
[ceilometer-collector] Continue resource injecting after samples failure
diff --git a/heka/files/lua/common/ceilometer.lua b/heka/files/lua/common/ceilometer.lua
index 56b1eec..47f3974 100644
--- a/heka/files/lua/common/ceilometer.lua
+++ b/heka/files/lua/common/ceilometer.lua
@@ -51,7 +51,7 @@
function decode(data)
local code, msg = inject(samples_decoder:decode(data))
- if code == 0 and resource_decoder then
+ if resource_decoder then
code, msg = inject(resource_decoder:decode(data))
end
return code, msg
diff --git a/heka/files/lua/common/resources.lua b/heka/files/lua/common/resources.lua
index 465585b..e33264e 100644
--- a/heka/files/lua/common/resources.lua
+++ b/heka/files/lua/common/resources.lua
@@ -100,11 +100,11 @@
function ResourcesDecoder:decode (data)
local ok, message = pcall(cjson.decode, data)
if not ok then
- return -2, "Cannot decode Payload"
+ return -1, "Cannot decode Payload"
end
local ok, message_body = pcall(cjson.decode, message["oslo.message"])
if not ok then
- return -2, "Cannot decode Payload[oslo.message]"
+ return -1, "Cannot decode Payload[oslo.message]"
end
local resource_payload = {}
if message_body['payload'] then
@@ -115,7 +115,7 @@
resource_msg.Timestamp = patt.Timestamp:match(message_body.timestamp)
return 0, resource_msg
end
- return -2, "Empty message"
+ return -1, "Empty message"
end
return ResourcesDecoder
diff --git a/heka/files/lua/common/samples.lua b/heka/files/lua/common/samples.lua
index 0516e8f..ad93873 100644
--- a/heka/files/lua/common/samples.lua
+++ b/heka/files/lua/common/samples.lua
@@ -173,11 +173,11 @@
function SamplesDecoder:decode (data)
local ok, message = pcall(cjson.decode, data)
if not ok then
- return -2, "Cannot decode Payload"
+ return -1, "Cannot decode Payload"
end
local ok, message_body = pcall(cjson.decode, message["oslo.message"])
if not ok then
- return -2, "Cannot decode Payload[oslo.message]"
+ return -1, "Cannot decode Payload[oslo.message]"
end
local sample_payload = {}
if message_body['payload'] then
@@ -188,7 +188,7 @@
sample_msg.Timestamp = patt.Timestamp:match(message_body.timestamp)
return 0, sample_msg
end
- return -2, "Empty message"
+ return -1, "Empty message"
end
return SamplesDecoder