fastify / fastify/help

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

Open
#1,027 12 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
No language data
Stars
68
Forks
8
Avg merge
11h 2m
Merged PRs (30d)
2

Description

Do we have a way to find out which routes are the problem?
```ts
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](https://github.com/fastify/help/assets/300961/ff8a3143-f2fc-41ed-b225-ade37c7792be)

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.