Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Add logs to CentralConfig 3xx and 4xx responses. #182

Closed
wants to merge 5 commits into from
Closed
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
22 changes: 17 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,23 @@ 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
) {
if (res.statusCode === 304) {
this._log.debug('[_pollConfig] statusCode: 304, message: No new config since last time')
res.resume()
return
}

if ([403, 404].includes(res.statusCode)) {
// something is wrong on the Central Config server.
switch (res.statusCode) {
case 403:
this._log.warn('[_pollConfig] statusCode: 403, message: Central config not enabled in APM Server')
break
case 404:
this._log.warn('[_pollConfig] statusCode: 404, message: Old APM Server that does not support central config')
break
}

res.resume()
return
}
Expand Down