npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mmarchini/observe

v3.0.0

Published

Inspector Protocol made easy

Downloads

2,141

Readme

Observe 🕵‍♀

GitHub Workflow Status (branch) Codecov branch npm

CLI tool to run common Inspector Protocol tasks on remote Node.js processes.

Why

There are several tools to interact with the Inspector Protocol. The Inspector API on Node.js core allows users to automate inspector protocol tasks, but it only interacts with the protocol within a Node.js process (it doesn't connect to external processes). node-inspect can connect to external processes, but since it's a REPL which doesn't allow for automation.

chrome-remote-interface addresses both issues, but users need to know how to use the inspector protocol to interact with it. Observe addresses that by providing shortcuts to common tasks used in production, such as taking snapshots or profiles. This allows users to get insights on their running applications without need to redeploy.

Install

$ npm install @mmarchini/observe

Or, use npx to get insights with a single command:

$ npx -q @mmarchini/observe ...

Note: since the result of observe is redirected to stdout, it's recommended to pass -q to npx to prevent unwanted lines in the output.

Usage

To execute a command, run npx -q @mmarchini/observe [command] [options]. For a full list of commands and options, run npx -q @mmarchini/observe -h. Available commands are:

  • heap-profile will take a Heap Profile
  • heap-snapshot will take a Heap Snapshot
  • cpu-profile will take a CPU Snapshot

By default the result will be outputted to stdout, so it can be piped to another process if needed without touching the filesystem (encryption, upload to another server, compression, etc.). --file will save the result to the filesystem instead.

All commands require at least one option: -p <pid> or -h <host>/-P <port>.

  • -p: will start the inspector protocol on the remote process <pid> by sending a SIGUSR1 signal to the process.
  • -h/-P: will attach to the inspector protocol on this remote or local host. Important, the app should already start debugger listening on the expected port.

Each command might also have their own options. For example, heap-profile accepts a -d <duration> option to determine for how long(in seconds) the profiler should run. npx -q @mmarchini/observe command -h will show all available options for the command.