Skip to content

Commit

Permalink
style(clustering): log pings only when the hash changes (#13885)
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Jaiswal <[email protected]>
  • Loading branch information
aryan9600 authored Dec 10, 2024
1 parent 96076c3 commit b594b1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kong/clustering/data_plane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ local PING_INTERVAL = constants.CLUSTERING_PING_INTERVAL
local PING_WAIT = PING_INTERVAL * 1.5
local _log_prefix = "[clustering] "
local DECLARATIVE_EMPTY_CONFIG_HASH = constants.DECLARATIVE_EMPTY_CONFIG_HASH
local prev_hash

local endswith = require("pl.stringx").endswith

Expand Down Expand Up @@ -100,8 +101,10 @@ local function send_ping(c, log_suffix)
ngx_log(is_timeout(err) and ngx_NOTICE or ngx_WARN, _log_prefix,
"unable to send ping frame to control plane: ", err, log_suffix)

else
ngx_log(ngx_DEBUG, _log_prefix, "sent ping frame to control plane", log_suffix)
-- only log a ping if the hash changed
elseif hash ~= prev_hash then
prev_hash = hash
ngx_log(ngx_INFO, _log_prefix, "sent ping frame to control plane with hash: ", hash, log_suffix)
end
end

Expand Down

1 comment on commit b594b1d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:b594b1d602321a3e6307cb4d2b7e78ed36645e34
Artifacts available https://github.com/Kong/kong/actions/runs/12256926064

Please sign in to comment.