Skip to content

Commit

Permalink
chore: change logging metrics structure (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvd11 authored Jun 22, 2021
1 parent 365d35b commit 7bfd800
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions kong/plugins/circuit-breaker/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ local function set_logger_metrics(api_identifier, new_state)
kong.ctx.shared.logger_metrics = {}
end
-- kong.ctx.shared object is specific to the lifecycle of a request and is used to share data between plugins
kong.ctx.shared.logger_metrics.circuit_breaker = {
"upstream:" .. upstream_host,
"circuit_breaker:" .. api_identifier,
"cb_state:" .. new_state
}
table.insert(kong.ctx.shared.logger_metrics, {
type = "circuit_breaker",
tags = {
"upstream:" .. upstream_host,
"circuit_breaker:" .. api_identifier,
"cb_state:" .. new_state
}
})

end

return {
get_excluded_apis = get_excluded_apis,
get_api_identifier = get_api_identifier,
set_logger_metrics = set_logger_metrics,
}
}

0 comments on commit 7bfd800

Please sign in to comment.