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

api-monitor-center

v1.1.1

Published

前端监控中心

Downloads

2

Readme

前端监控中心


1、安装使用

npm install --save fe-api-monitor-center

监控 拦截器中应用 demo

function monitor(xhr, type) {
  // 2000 系统错误,看各自的系统实际设定
  const monitorCodes = [2000]
  let res = xhr.data
  let config = xhr.config
  if (location.href.indexOf('.com') === -1) {
    // monitor = function monitor () {}
    return
  }
  if (typeof res === 'object' && res.codeNum && monitorCodes.indexOf(res.codeNum) === -1) {
    return
  }
  feMonitorCenter('apiMonitor', {
    url: config.url,
    param: config.requestMethod === 'get' ? config.params : config.data,
    response: JSON.stringify(res),
    desc: xhr.message || '接口响应异常',
    app: '官网控制台项目',
    method: config.requestMethod || 'post',
    group: 4,
    type: type,
    href: location.href
  }, {
    frequency: 1, // 接收频率
    noSendMail: false, // 不发送邮件
    noInsertDb: false // 不插入数据库
  })
}

1、接口异常监控

收集各个业务方接口的报错信息,包含超时以及系统异常等,快速发现问题,及时响应
  • 业务方
  • 应用
  • 接口地址
  • 错误原因
  • 服务端相应的数据
  • 前端传递的参数(待定)

2、js报错搜集

利用window.onerror 和 try catch将搜集页面的js报错,便于前端了解系统的代码质量
  • 业务方
  • 应用
  • 页面地址
  • 错误日志
  • 错误的行、列(待定)

3、埋点(?)

统计各种行为产生的pv,uv,便于产品决策
  • 业务方
  • 应用
  • 页面
  • 哪种行为
  • +1

4、页面性能统计(?)

基于performance统计前端页面一些关键信息的耗时,便于前端横向对比各个系统的代码性能
  • domReady时间
  • onload时间
  • 各种cdn资源(js、img、css)的相应时间