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 🙏

© 2026 – Pkg Stats / Ryan Hefner

jiqi-f-monitor

v1.2.1

Published

A Web monitor plugin.

Readme

项目参考

功能模块

  1. SDK

  • 用户行为数据:pvuv
  • 异常监控:JS异常HTTP异常资源异常Promise异常
  • 性能数据监控:fpfcpDOMready, DNS,...
  • HTTP请求监控:成功率

监控sdk部分我们需要将其包装成插件形式来使用

  1. 监控应用

  • 展示监控数据图表的后台系统
  • 后端服务器:保存历史数据
  1. 被监控应用

  • 被监控的前端应用
  • 后端服务器:正常返回的api,发生错误的api,慢返回的api

用户行为数据

PV

用户每次进入页面时上报即可,需要注意SPA单页面应用要结合路由跳转

UV

服务端根据cookie判断PV的第一次上报即为一次UV

异常监控

重复异常不应上报,所以要生成uuid
解析Error对象里的错误堆栈
需要得到错误代码的行数,如果是打包后的文件因为是混淆的源码,还需要存储着代码混淆前后的位置对应信息Sourcemap文件。

JS异常

window.onerror捕获全局的JS异常,addEventListener('error')不仅可以捕获全局的JS异常,还可以捕获静态资源加载异常
JS异常带有错误类型参数,例如SyntaxErrorTypeErrorReferenceError

Promise异常

Promise异常会触发unhandledrejection事件

HTTP异常

至少需要捕获具体接口状态码,请求参数
Promise.catch得不到这些信息,还是需要劫持XHRFetch

React错误捕获

错误边界ErrorBoundary里的componentDidCatch钩子函数会暴露出异常,这种也需要单独考虑,不知道这种会不会被JS异常暴露出来。然后Vue也有错误捕获,就暂时不考虑了。

性能数据监控

window.performance获取,W3C level2扩充该属性并增加了PerformanceObserver
Google基于此开源了web-vitals插件

HTTP请求监控

请求链路,成功率,返回信息,参考https://help.aliyun.com/document_detail/91587.html

劫持XHRFetch,计算耗时

发送方式

将以上监控数据带上时间缓存在队列里,分批发送给后端,一个个发送太耗费通信资源。
为了不影响页面性能,将发送数据这个动作放在requestIdleCallback函数里,这个函数是趁着页面刷新间隙执行的,这段时间浏览器是空闲的。