Skip to content

Commit

Permalink
stop logging undefined on local requests
Browse files Browse the repository at this point in the history
  • Loading branch information
sipec committed Nov 5, 2024
1 parent e71fc41 commit b623c5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ const requestMonitoring: RequestHandler = (req, res, next) => {
}
const startTs = hrtime.bigint()
const isLocalhost = req.get('host')?.includes('localhost')
if (
!isLocalhost ||
(isLocalhost && !ignoredEndpoints.some((e) => endpoint.startsWith(e)))
) {
if (!isLocalhost) {
log(`${method} ${url} ${process.env.PORT}`)
} else if (!ignoredEndpoints.some((e) => endpoint.startsWith(e))) {
log(`${method} ${url}`)
}
metrics.inc('http/request_count', { endpoint, baseEndpoint, method })
res.on('close', () => {
Expand Down

0 comments on commit b623c5e

Please sign in to comment.