From 7bfd80044b41750e95a85c5727e78f43574dca7a Mon Sep 17 00:00:00 2001 From: dhruvd11 <62890722+dhruvd11@users.noreply.github.com> Date: Tue, 22 Jun 2021 15:11:01 +0530 Subject: [PATCH] chore: change logging metrics structure (#10) --- kong/plugins/circuit-breaker/helpers.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kong/plugins/circuit-breaker/helpers.lua b/kong/plugins/circuit-breaker/helpers.lua index 9ed2401..4e5a611 100644 --- a/kong/plugins/circuit-breaker/helpers.lua +++ b/kong/plugins/circuit-breaker/helpers.lua @@ -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, -} \ No newline at end of file +}