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

wobs-js

v0.1.2

Published

Wuying Observer SDK for JavaScript

Readme

Wuying GuestOS Observer JavaScript

功能

  • 记录埋点和Trace数据
  • 埋点的数据格式是JSON对象,包含埋点名称(eventName)、时间(time)、属性(properties)和一些其它的配置信息,比如实例名称、版本等信息。
  • Trace数据格式是JSON对象,包含TraceID、SpanID、ParentSpanID、Name、Kind、StartTime、EndTime、Duration、Attributes、Events、Links、StatusCode、StatusMessage等信息。以SLS Trace数据格式输出到本地文件。

使用方法

  1. 创建一个Node.js项目
  2. 使用示例可以参考examples/demo.js
const { init, shutdown, newSpanAsCurrent, newTrackPoint } = require('wobs-js');

if (require.main === module) {
    // 初始化observer,指定trackpoint和trace文件存放目录,这里设置为当前路径,默认可不填,和C++、Golang版本保持一致
    init("test", './', './');

    // 创建一个span,并设置属性和事件
    const span = newSpanAsCurrent("test_trace");
    // 设置属性
    span.setAttribute("key", "value");
    // 添加事件
    span.addEvent("event1", {"event_attr": "event_value"});
    // 如果失败了,设置trace的状态和错误信息
    span.setStatus(getStatus(false), "error message");
    // 记录一个埋点
    newTrackPoint("test_trace");
    span.end();

    // 程序结束后关闭observer,这一步是可选的
    shutdown();
}

如何使用远端的trace_id创建span

创建span时,可以指定trace_id和span_id,这样trace_id和span_id就会作为span的父span,从而实现链路追踪。

const span = newSpanAsCurrent("test_trace", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxx");
span.setAttribute("key", "value");
span.end();

依赖

  • Node.js >= 12.0.0

Windows平台支持

在Windows平台上,本SDK支持从注册表读取用户和系统信息,包括:

  • 阿里云EDS Agent相关信息
  • Windows版本信息
  • 用户桌面和实例信息

注册表读取通过Node.js的child_process模块调用Windows的reg命令实现,无需额外的依赖包。