@ botiverse/ hands- electron
Electron apps 的崩溃报告,由 双手。 。 。 .
电能内置 崩溃 抓取本地小型泵,用于 主要进程和制造进程 财务报告和审定财务报表 把它们直接上传到Hands, 存放在那里作为坠机票和 与您上传的 Breakpad 符号相对应的象征性服务器侧 。 这个SDK线 增加渲染器/程序崩溃的听器,并管理崩溃范围 (用户/标记 / 额外/面包屑) 在下一个垃圾堆上随行.
SDK有两个切入点 比如 @sentry/electron: 一个给 主要
进程和一个 渲染器。 。 。 .
安装
npm install @botiverse/hands-electron
electron 由您的应用程序提供.
主要进程
打电话 init() 在应用程序准备好之前:
import { app } from "electron";
import * as Hands from "@botiverse/hands-electron/main";
Hands.init({
appSlug: "my-desktop-app", // your Hands app slug
clientKey: "qk_live_...", // public client key (safe to ship)
release: app.getVersion(), // version_name (defaults to app.getVersion())
versionCode: 1020300, // Hands version_code → picks the symbol set
environment: "stable", // channel
extra: { deployment: "ga" }, // static annotations on every crash
onCrash: (info) => {
// renderer / child-process termination (incl. oom / killed, which produce
// no minidump) — log, show a dialog, etc.
console.warn("process gone:", info.processType, info.reason);
},
});
// Attach context that rides along on the next crash:
Hands.setUser({ id: "u_123", email: "[email protected]" });
Hands.setTag("feature", "editor");
Hands.setExtra("open_docs", 3);
Hands.addBreadcrumb({ message: "opened project", category: "ui" });
init() 并使用节奏发射/安装度量衡向Hands发送
随机存储在 Electron 下的每个安装设备 ID userData. 这种权力
活动数据和版本分配分析; 在线不真实
心跳声 使用 Hands.reportDevice(options) 如果需要强制测量
在正常的24h节节流阀之外.
渲染器进程
主进程 Crashpad 自动捕捉到 Render 相撞器 渲染器条目仅管理范围并转发到主要之上的 IPC :
import * as Hands from "@botiverse/hands-electron/renderer";
Hands.setTag("route", location.pathname);
Hands.addBreadcrumb({ message: "clicked export" });
用于沙盒成型器(contextIsolation: true,将API从你的
替换为预装入脚本 :
// preload.ts
import { exposeHands } from "@botiverse/hands-electron/preload";
exposeHands(); // → window.hands.setTag(...), window.hands.addBreadcrumb(...)
符号( 服务器侧符号)
迷你泵只有在Hands拥有您的应用程序的 Breakpad 时才会变成可读堆栈
符号 version_code在 CI 中,用
dump_syms 并同时上传
释放 :
# produce .sym files for your app + Electron framework binaries
dump_syms path/to/MyApp > syms/MyApp.sym
# … repeat per binary, then zip them (flat is fine — Hands reads each
# file's MODULE header to place it correctly) …
zip -r symbols.zip syms/
hands builds publish-electron my-desktop-app \
--version-name 1.2.3 --version-code 1020300 \
--installer dist/MyApp-1.2.3.exe \
--symbols symbols.zip
一旦符号出现,每张坠机票就会有一个符号堆栈作为 一个评论。 没有符号, Hands 仍然用模块+相撞来记录崩溃 边框.
发送什么
每个小型泵都装有哨兵电动式的注释,设置了服务器折叠
输入入票: product_type=electron, (中文(简体) ), version, (中文(简体) ), version_code, (中文(简体) ),
environment编号 :channel, (中文(简体) ), platform, (中文(简体) ), arch, (中文(简体) ), process_type, (中文(简体) ),
electron_version, (中文(简体) ), chrome_version,加任意 extra 和当前
用户/tags/面包屑.