Skip to content

Commit

Permalink
Merge pull request #3 from well-known-components/fix/add-live-request
Browse files Browse the repository at this point in the history
fix: Prevent the live and ready requests from being printed
  • Loading branch information
LautaroPetaccio authored Mar 8, 2023
2 parents c4e07c3 + 2a9d235 commit 256d1c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IHttpServerComponent, ILoggerComponent } from '@well-known-components/interfaces'
import { HEALTH_PATH } from './constants'
import { HEALTH_LIVE, HEALTH_READY } from './constants'
import { shouldSkip } from './logic'
import { RequestLoggerConfigurations, Verbosity } from './types'

Expand All @@ -19,7 +19,7 @@ export function instrumentHttpServerWithRequestLogger(
const skipInput = config?.skipInput
const skipOutput = config?.skipOutput
// Skip health checks by default
const skip = shouldSkip(ctx, config?.skip ?? HEALTH_PATH)
const skip = shouldSkip(ctx, config?.skip ?? [HEALTH_LIVE, HEALTH_READY])

const inLog = config?.inputLog ? config.inputLog(ctx.request) : `[${ctx.request.method}: ${ctx.url.pathname}]`
if (!skipInput && !skip) {
Expand Down
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const HEALTH_PATH = '/health/live'
export const HEALTH_LIVE = '/health/live'
export const HEALTH_READY = '/health/ready'

0 comments on commit 256d1c8

Please sign in to comment.