Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style(clustering): add some useful CP/DP logs #13885

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aryan9600
Copy link
Member

Summary

Add the config hash in the log statement while sending a ping to the controlplane. This enables us to see which hash the gateway was using at a particular moment in time, consequently helping us figure out for how long did gateway run with a stale configuration.
Update the log that records a new CP connection to the INFO level, since it can provide useful into its connection with the controlplane. I don't think it is chatty enough to cause a problem when its being logged at this level.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix #[issue number]

@github-actions github-actions bot added core/clustering cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Nov 18, 2024
@chronolaw chronolaw changed the title Cp dp logs style(clustering): add some useful CP/DP logs Nov 18, 2024
@@ -101,7 +101,7 @@ local function send_ping(c, log_suffix)
"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)
ngx_log(ngx_DEBUG, _log_prefix, "sent ping frame to control plane with hash: ", hash, log_suffix)
Copy link
Member

Choose a reason for hiding this comment

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

should we only log this once per hash and not per ping.

Copy link
Member Author

Choose a reason for hiding this comment

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

just to confirm you mean we could log the new hash only after we process the reconfigure event and update the declarative config? in that case, yes we could do that as well.
but this log line also gives us a good idea of the dataplane's configuration state. furthermore, it's not really adding a new log statement but merely appending a few bytes to an existing log statement.

@@ -90,7 +90,7 @@ function _M.connect_cp(dp, endpoint, protocols)
wss_proxy_authorization = proxy_opts.proxy_authorization,
}

ngx_log(ngx_DEBUG, _log_prefix,
ngx_log(ngx_INFO, _log_prefix,
Copy link
Member

Choose a reason for hiding this comment

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

same here, only log when we receive different hash.

Copy link
Member Author

Choose a reason for hiding this comment

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

i'm not familiar with the gateway, so please correct me if i'm wrong. this function is used to open a new connection to the controplane, which is unrelated to receiving a new hash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/clustering size/XS skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants