Skip to content

Commit

Permalink
Merge branch 'hotfix/galileo' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Feb 3, 2016
2 parents 75f85ad + c417407 commit 6c94eed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kong/plugins/log-serializers/alf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function _M.serialize_entry(ngx)
-- other properties are used to compute the ALF properties.

-- bodies
local analytics_data = ngx.ctx.analytics
local analytics_data = ngx.ctx.analytics or {}

local alf_req_body = analytics_data.req_body or ""
local alf_res_body = analytics_data.res_body or ""
Expand Down
6 changes: 3 additions & 3 deletions kong/plugins/mashape-analytics/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local EMPTY_ARRAY_PLACEHOLDER = "__empty_array_placeholder__"
-- The policy will give a delay that grows everytime
-- Galileo fails to respond. As soon as Galileo responds,
-- the delay is reset to its base.
local dict = ngx.shared.locks
local dict = ngx.shared.cache
local RETRY_INDEX_KEY = "mashape_analytics_retry_index"
local RETRY_BASE_DELAY = 1 -- seconds
local RETRY_MAX_DELAY = 60 -- seconds
Expand Down Expand Up @@ -194,7 +194,7 @@ end
-- If the connection to the collector fails, use the retry policy.
function buffer_mt.send_batch(premature, self)
if premature or self.lock_sending then return end

self.lock_sending = true -- simple lock

if table_getn(self.sending_queue) < 1 then
Expand Down Expand Up @@ -283,4 +283,4 @@ function buffer_mt.send_batch(premature, self)
end
end

return buffer_mt
return buffer_mt
6 changes: 4 additions & 2 deletions kong/plugins/mashape-analytics/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ end
function AnalyticsHandler:body_filter(conf)
AnalyticsHandler.super.body_filter(self)

local chunk = ngx.arg[1]
-- concatenate response chunks for ALF's `response.content.text`
if conf.log_body then
ngx.ctx.analytics.res_body = ngx.ctx.analytics.res_body..chunk
local chunk = ngx.arg[1]
local analytics_data = ngx.ctx.analytics or {res_body = ""} -- minimize the number of calls to ngx.ctx while fallbacking on default value
analytics_data.res_body = analytics_data.res_body..chunk
ngx.ctx.analytics = analytics_data
end
end

Expand Down

0 comments on commit 6c94eed

Please sign in to comment.