Skip to content

Sentry SDK for HarmonyOS - 鸿蒙应用监控SDK,支持错误追踪和性能监控

License

Notifications You must be signed in to change notification settings

cyber-stanny/sentry-harmony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentry Harmony

🎯 Sentry SDK for HarmonyOS - 鸿蒙应用监控 SDK

基于 Sentry Core 的 HarmonyOS 异常监控和性能追踪 SDK。对标 sentry-miniapp,专为鸿蒙生态打造。

✨ 特性

  • 🚀 基于 Sentry JavaScript SDK 核心模块
  • 🎯 自动捕获 HarmonyOS 应用生命周期异常
  • 📍 默认上报异常发生时的页面路由栈
  • 🍞 自动记录面包屑(设备信息、用户操作、网络请求等)
  • ⚡ 支持性能监控(导航性能、渲染性能)
  • 🔧 TypeScript 编写,提供完整的类型定义
  • 📱 专为 HarmonyOS 应用设计

📦 安装

ohpm install sentry-harmony

🚀 快速开始

import * as Sentry from 'sentry-harmony';

Sentry.init({
  dsn: 'https://xxx@xxx.ingest.sentry.io/xxx',
  // 可选配置
  debug: false,
  environment: 'production',
  release: '1.0.0',
  // 采样率
  sampleRate: 1.0,
  // 性能监控采样率
  tracesSampleRate: 0.1,
});

📖 详细文档

🏗️ 架构

sentry-harmony/
├── src/
│   ├── core/           # 核心模块
│   │   ├── hub.ts      # Hub 管理
│   │   ├── client.ts   # 客户端
│   │   └── scope.ts    # 作用域
│   ├── integrations/   # 集成模块
│   │   ├── globalHandlers.ts    # 全局异常处理
│   │   ├── breadcrumbs.ts       # 面包屑
│   │   └── httpContext.ts       # HTTP 上下文
│   ├── transports/     # 传输层
│   │   └── fetch.ts    # 网络传输
│   ├── types/          # 类型定义
│   └── index.ts        # 入口
├── example/            # 示例项目
└── docs/               # 文档

🤝 对比 sentry-miniapp

特性 sentry-miniapp sentry-harmony
平台 微信小程序/小游戏 HarmonyOS
运行时 微信 JSRuntime ArkCompiler
网络 wx.request @ohos.net.http
生命周期 App/Page UIAbility
存储 localStorage Preferences

📝 License

MIT

👨‍💻 作者


💡 灵感来源于 sentry-miniapp,感谢至尧的开源贡献。

About

Sentry SDK for HarmonyOS - 鸿蒙应用监控SDK,支持错误追踪和性能监控

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published