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

chore: add some logging for 3xx and 4xx responses polling for central config #3549

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ Notes:
=== Node.js Agent version 3.x


==== Unreleased

[float]
===== Breaking changes

[float]
===== Features

[float]
===== Bug fixes

[float]
===== Chores

* Add debug logging for 4xx responses from APM server when polling for
central config. This is based on https://github.com/elastic/apm-nodejs-http-client/pull/182
by @linjunpop.


[[release-notes-3.49.0]]
==== 3.49.0 - 2023/08/03

Expand Down
18 changes: 13 additions & 5 deletions lib/apm-client/http-apm-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,19 @@ Client.prototype._pollConfig = function () {

this._scheduleNextConfigPoll(getMaxAge(res));

if (
res.statusCode === 304 || // No new config since last time
res.statusCode === 403 || // Central config not enabled in APM Server
res.statusCode === 404 // Old APM Server that doesn't support central config
) {
// Spec: https://github.com/elastic/apm/blob/main/specs/agents/configuration.md#dealing-with-errors
if (res.statusCode === 304) {
this._log.trace('_pollConfig: no new central config since last poll');
res.resume();
return;
} else if (res.statusCode === 403) {
this._log.debug('_pollConfig: central config not enabled in APM Server');
res.resume();
return;
} else if (res.statusCode === 404) {
this._log.debug(
'_pollConfig: old APM server does not support central config',
);
res.resume();
return;
}
Expand Down
Loading