@apminsight/native-stats

中文文档
2.0.0发布于 2026/01/13UnlicenseCommonJS近 30 天下载 3.5万

Exposes node v8 garbage collection stats

原始使用文档
文档目录5 节
  1. Table of contents:
  2. Node VM installation
  3. Prerequisites to install NVM
  4. Getting started
  5. Performance metrics

Native Metrics for Site24x7 Node.js Agent

The Site24x7 Node.js agent uses @apminsight/native-stats, a native node add-on for collecting GC and event loop stats using the Chromes' V8 engine. These metrics can help improve your application's performance and identify bottlenecks in the application.

Before you can use NVM, you need to install the Site24x7 Node.js agent.

To get APM Insight NVM, follow the below given instructions.

Table of contents:

  • Node VM installation
  • Prerequisites to install NVM
  • Getting started
  • Performance Metrics

Node VM installation

  • The native module is automatically installed while installing the Node.js agent.(v3.0.0 or higher).
  • During installation, the native module first attempts to build from the source on the target machine. If the build fails, Node.js prints a stack trace to the console, which you can ignore.
  • If the native module build is successful, you can see all the metrics, including garbage collection, memory usage, event loop data, and CPU utilization. If the build fails, you can only see memory and CPU related metrics.

Prerequisites to install NVM

PlatformEnvironment
Unix/LinuxMake, C/C++ compiler (such as GCC)
macOSXcode Command Line Tools
WindowsVisual C++ Build Environment

Getting started

Gain insight into useful runtime data for troubleshooting performance issues and monitoring your application's health with NVM metrics.

To view the NVM metrics in the client:

  • Log in to your Site24x7 web client
  • Navigate to APM > your Node.js application > click the Node VM tab.
  • Select the time frame for which you need the metrics.

You will get the graphs and metrics using which you can troubleshoot performance issues.

Performance metrics

  • GC Pause Time: The amount of time spent on garbage collection. Spikes in GC time usually indicate a problem.
  • GC Pause Frequency: The number of GC runs performed per minute.
  • Memory Usage: The amount of memory consumed by the Node.js process.
  • CPU Utilization: The CPU utilization of the Node.js process.
  • Event Loop Ticks Per Minute: The number of event loop ticks per minute.
  • Max CPU time per tick: The maximum amount of time spent in a single tick per minute.

版本与发布记录

@apminsight/native-stats 共发布 2 个版本,首次发布于 2023/03/20;过去 12 个月发布了 1 个版本。

版本发布日期距今
2.0.0latest2026/01/139 个月前
1.0.02023/03/203 年前

关于 @apminsight/native-stats 的常见问题

@apminsight/native-stats 是什么?

Exposes node v8 garbage collection stats

如何安装 @apminsight/native-stats?

在项目目录运行 npm install @apminsight/native-stats,或使用 pnpm add / yarn add / bun add。

@apminsight/native-stats 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/apminsight__native-stats 是否存在。

@apminsight/native-stats 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@apminsight/native-stats 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@apminsight/native-stats 可以商用吗?

@apminsight/native-stats 使用 Unlicense 许可。作者将代码贡献到公共领域,可不受限制地使用。以上为概括,不构成法律意见,请以许可原文为准。

@apminsight/native-stats 的下载量有多少?

根据 npm 官方下载统计,@apminsight/native-stats 在 2026/10/07 – 2026/11/05 这 30 天内被下载 35,212 次,日均约 1,174 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apminsight/native-stats 还在维护吗?

最新版本 2.0.0 发布于 2026/01/13(9 个月前);至今共发布 2 个版本,其中过去 12 个月发布了 1 个;首次发布于 2023/03/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。