Skip to content

Commit

Permalink
PP-12828 Update logging in connector client to only record 5xx respon…
Browse files Browse the repository at this point in the history
…ses to GET as error, record non-200 responses as warnings
  • Loading branch information
DomBelcher committed Oct 18, 2024
1 parent b2ef822 commit 25037c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/services/clients/connector.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,22 @@ async function _getConnector (url, description, loggingFields = {}, callingFunct
const response = await client.get(`${url}`, description)
logger.info('GET to %s ended - total time %dms', url, new Date() - startTime, loggingFields)
incrementStatusCodeCounter(callingFunctionName, response.status)
if (response.status !== 200) {
if (response.status > 499 && response.status < 600) {
logger.error(`Error communicating with ${url}`, {
...loggingFields,
service: 'connector',
method: 'GET',
status_code: response.status,
url: url
})
} else if (response.status !== 200) {
logger.warn(`Non-200 response received communicating with ${url}`, {
...loggingFields,
service: 'connector',
method: 'GET',
status_code: response.status,
url: url
})
}
return response
} catch (err) {
Expand Down

0 comments on commit 25037c7

Please sign in to comment.