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

js-apm-monitor

v1.0.0-alpha.6

Published

Web App performance and exception monitor

Downloads

4

Readme

js-apm-monitor

js-apm-monitor 是一个简单、轻量级的H5性能和异常监控库。致力于为H5开发者提供快捷的手段监控H5页面性能和异常的基础数据并上报。

设计思路

特性

  • 简洁的API设计,开箱即用;
  • 使用 TypeScript 构建,提供可靠性;
  • 一站式满足性能和异常的监控需求;
  • 日志上报服务支持定制化;

使用

安装

npm install --save js-apm-monitor

使用

import apmMonitor from 'js-apm-monitor';
apmMonitor.init({
    url: 'your upload url',
    monitor: {
        performance: true,  // 开启性能监控
        requestPerformance: true,   // 开启接口性能监控
        jsError: true,  // 开启JS运行异常监控
        consoleError: true, // 开启console.error 错误上报
        resourceError: true,    // 开启资源加载异常监控
        requestError: true, // 开启请求异常监控
    }
})

自定义上报方法

apmMonitor.customReporter((log) => {
    // your report code
    tracker.track({
        name: 'log',
        ...log
    })
})

日志字段

基础字段

| 字段名 | 中文名 | 解释 | |----|----|-----| |useragent|UA|| |client_os|客户端系统|| |client_os_version|客户端系统版本好|| |network|网络类型|| |browser|浏览器名称|| |browser_version|浏览器版本号|| |screen_width|屏幕宽度|| |screen_height|屏幕高度||

性能日志字段

| 字段名 | 中文名 | 解释 | |----|----|-----| |redirect_time|重定向耗时|| |dns_time|DNS 解析耗时|| |tcp_time|TCP 连接耗时|| |ssl_time|SSL 安全连接耗时|| |ttfb_time|网络请求耗时|读取到第一个字节的时间| |response_time|数据传输耗时|| |dom_analysis_time|DOM 解析耗时|| |resources_time|资源加载耗时|| |firstbyte_time|首包时间|| |fpt_time|首次渲染时间|| |tti_time|首次可交互时间|单页应用此时还不可交互| |dom_ready_time|DOM Ready 时间|| |load_time|页面完全加载时间|参考价值不大,部分图片可能加载很慢| |资源加载性能| |script_count|JS资源数量|| |script_load_time|所有JS加载耗时|从第一个JS加载开始到最后一个JS加载完成之间的耗时| |style_count|样式资源数量|| |style_load_time|所有样式加载耗时|从第一个style加载开始到最后一个style加载完成之间的耗时| |img_count|图片资源数量|| |img_load_time|所有图片加载耗时||

异常日志字段

| 字段名 | 中文名 | 值 | |----|----|-----| |error_type|错误类型|(script | unhandledrejection | resource | consoleError | fetch | ajax)| |error_level|错误等级|error| |error_url|报错文件|| |error_lineno|报错行|| |error_colno|报错列|| |error_stack|报错堆栈|| |error_msg|错误详情||