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

@lsner/raven-baidu

v0.0.12-0

Published

Sentry SDK for BaiduLite

Downloads

2

Readme

Raven-weapp

为方便百度小程序接入 sentry,由 raven 改写而来的百度小程序版本。

支持微信、百度、头条、qq、支付宝小程序

引入文件

由于目前小程序不支持从 node_modules 中引入文件,因此以 npm 方式安装的话只能手动将 raven-weapp/dist 目录下需要的文件拷贝到其他文件中,在 app.js 中引入,例如:

var Raven = require('./utils/raven-weapp/build/raven')

或以 Bower 安装 raven-weapp 并引入:

var Raven = require('./bower_components/raven-weapp/build/raven')

初始化 Raven

Raven.config('https://[email protected]/x', options).install()

在 app 的 onLaunch 中初始化(?),options 为可选配置对象,目前支持:

options = {
    release: '当前小程序版本',
    environment: '指定为production才会上报',
    allowDuplicates: true, // 允许相同错误重复上报
    sampleRate: 0.5 // 采样率
}

收集信息

收集的信息将在上报时被一起带上

基本信息

初始化后 raven 会默认收集以下信息:

{
    SDKversion: '小程序基础库版本',
    BDversion: '百度版本',
    device: '设备型号',
    network: '网络类型',
    system: '系统信息',
}

可以通过Raven.setUserContext(context)或者Raven.setExtraContext(context)添加更多信息(kdtId 和 userId 等)

用户行为
console

console 的行为默认将被自动收集

ajax

wx.request 不可扩展,因此只能手动收集请求的行为:例如在经过封装的请求函数的成功回调内添加:

Raven.captureBreadcrumb({
  category: 'ajax',
  data: {
    method: 'get',
    url: 'weapp.showcase.page/1.0.0/get',
    status_code: 200
  }
dom

ui 操作的记录暂不支持

location

页面变化的记录暂不支持

信息上报

分为 message 和 exception 的上报

message

使用Raven.captureMessage(msg, option)上报需要上报的信息比如 ajax 的报错等

exception

所有 uncaught exception 都会被小程序捕获封装成 msg 传递到 app 的 onError 中,在 onError 中上报这些信息:

onError(msg) {
    Raven.captureException(msg, {
      level: 'error'
    })
  }