
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
profiler-heapdump
Advanced tools
Provides ability to capture a profile and heapdump via a curl or wget commands which downloads the results to the local filesystem.
Provides ability to capture a profile and heapdump via a curl or wget commands which downloads the results to the local filesystem.
Profile via a curl or wget command which downloads the results to the local filesystem. Configurable sampling and profile duration.
For compatibility, utilizes the node.js integrated inspector API.
Use when a profile is needed in a remote environment and the server is accessible, but not the filesystem. In kubernetes, if profiling writes to a local ephemeral filesystem and the pod or minion crashes, the file is lost.
This library efficiently streams the results back to prevent dominating the event thread which would unnecessarily increase latency of other requests.
Uses either a provided express app or creates a new express app. The new express app provides auth and exponential rate limiting on auth failures. If using a provided express app, BYO auth and rate limiting. The auth middleware which includes rate limiting is exposed for use with provided express apps via the getAuthMiddleware function.
Parameters:
The longer duration or the higher the sample rate, the more memory required and larger the file.
# default test config is basic auth, this will fail with 401
curl --compressed \
-G http://localhost:6660/debug/profile \
-d durationSec=10 \
-d sampleRateUs=1000 \
-o testProfile1.cpuprofile \
-H "Authorization: Bearer changeme"
OR
curl --compressed \
'http://localhost:6660/debug/profile?durationSec=10&sampleRateUs=1000' \
-o testProfile1.cpuprofile \
-u "change:me"
OR
wget --http-user=change --http-password=me --auth-no-challenge \
'http://localhost:6660/debug/profile?durationSec=10&sampleRateUs=1000' \
-O testProfile1.cpuprofile
-u "username:password"
-H "Authorization: Bearer <TOKEN>"
Using '--auth-no-challenge' reduces an extra round-trip to challenge wget.
--user <user> --password <pass> --auth-no-challenge
--header="Authorization: Bearer <TOKEN>"
import { init, shutdown } from 'profiler-heapdump'
const app = express()
// BYO auth or use built-in auth with rate-limiting
app.use('/debug', init({
server: {
isExistingExpressApp: true,
},
}))
// start the server
// const server = app.listen ...
import { init, shutdown } from 'profiler-heapdump'
init({
authentication: {
bearer: 'changeme',
},
})
// on sigterm gracefully shutsdown the server by calling shutdown
Below are the defaults. Be sure to set the authentication.
const defaultOptions = {
server: {
isExistingExpressApp: false,
newExpresRoutePrefix: undefined,
bind: {
host: '127.0.0.1',
port: 6660,
},
authentication: {
basic: {
username: undefined,
password: undefined,
},
bearerToken: undefined,
},
},
cpu: {
profiling: {
durationMs: 10000,
sampleRateUs: 1000, // 1 ms
},
},
}
Get heap dump via a curl or wget command which downloads the results to the local filesystem.
# default test config is basic auth, this will fail with 401
curl --compressed \
-G http://localhost:6660/debug/heapdump \
-o testHeap.heapsnapshot \
-H "Authorization: Bearer changeme"
OR
curl --compressed \
'http://localhost:6660/debug/heapdump' \
-o testHeap.heapsnapshot \
-u "change:me"
OR
wget --http-user=change --http-password=me --auth-no-challenge \
'http://localhost:6660/debug/heapdump' \
-O testHeap.heapsnapshot
FAQs
Provides ability to capture a profile and heapdump via a curl or wget commands which downloads the results to the local filesystem.
The npm package profiler-heapdump receives a total of 0 weekly downloads. As such, profiler-heapdump popularity was classified as not popular.
We found that profiler-heapdump demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.