Skip to content

Fastify under-pressure how to find out which routes are reasons  #1027

Open
@meotimdihia

Description

@meotimdihia

Do we have a way to find out which routes are the problem?

fastify.register(underPressure, {
  maxEventLoopDelay: 1000,
  exposeStatusRoute: true,
  pressureHandler: (req, rep, type, value) => {
      if (type === underPressure.TYPE_HEAP_USED_BYTES) {
        fastify.log.warn(`too many heap bytes used: ${value}`)
      } else if (type === underPressure.TYPE_RSS_BYTES) {
        fastify.log.warn(`too many rss bytes used: ${value}`)
      } else if (type == underPressure.TYPE_EVENT_LOOP_DELAY) {
        fastify.log.warn(`reached max even loop delay: ${value}`)
        fastify.Sentry.captureMessage('reached max even loop delay');
      }

      rep.send('out of memory') // if you omit this line, the request will be handled normally
    }
  })

image

Please give me a tip/guide. I don't know how to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions