XTrace:一种用于Android应用程序生产的非侵入式动态追踪框架
XTrace: A Non-Invasive Dynamic Tracing Framework for Android Applications in Production
AI总结:
XTrace通过非侵入式代理技术,在不发布应用的情况下实现Android生产环境中的动态追踪,提升稳定性与覆盖率的平衡。
摘要:
随着移动应用复杂性呈指数增长,用户设备环境的碎片化也加剧,确保在线应用程序稳定性面临前所未有的挑战。传统方法,如静态日志记录和崩溃后分析,缺乏实时上下文信息,无法应对仅在特定场景下显现的'幽灵bug'。这凸显了对动态运行时可观测性的迫切需求:在不需应用发布的情况下拦截和追踪任意方法。我们提出了XTrace,一种新的动态追踪框架。XTrace引入了一种非侵入式代理的新范式,避免直接修改虚拟机的底层数据结构。它通过利用和优化Android ART虚拟机高度稳定、内置的仪器化机制,实现高性能的方法拦截。在拥有数亿日活跃用户的ByteDance应用中评估,XTrace展示了生产级的稳定性和性能。大规模在线A/B实验证实了其稳定性,显示对崩溃用户率或ANR率没有统计学上显著影响(p>0.不受显著影响),同时保持了最小的开销(<7毫秒启动延迟,<0.01毫秒每方法调用)和广泛的兼容性(Android 5.0-15+)。关键的是,XTrace诊断了超过11个严重的在线崩溃和多个性能瓶颈,将根本原因定位效率提高了超过90%。这证实了XTrace提供了一种生产级解决方案,解决了Android动态追踪中长期存在的稳定性与全面覆盖之间的冲突。
英文摘要:
As the complexity of mobile applications grows exponentially and the fragmentation of user device environments intensifies, ensuring online application stability faces unprecedented challenges. Traditional methods, such as static logging and post-crash analysis, lack real-time contextual information, rendering them ineffective against "ghost bugs" that only manifest in specific scenarios. This highlights an urgent need for dynamic runtime observability: intercepting and tracing arbitrary methods in production without requiring an app release. We propose XTrace, a novel dynamic tracing framework. XTrace introduces a new paradigm of non-invasive proxying, which avoids direct modification of the virtual machine's underlying data structures. It achieves high-performance method interception by leveraging and optimizing the highly stable, built-in instrumentation mechanism of the Android ART virtual machine. Evaluated in a ByteDance application with hundreds of millions of daily active users, XTrace demonstrated production-grade stability and performance. Large-scale online A/B experiments confirmed its stability, showing no statistically significant impact (p > 0.05) on Crash User Rate or ANR rate, while maintaining minimal overhead (<7 ms startup latency, <0.01 ms per-method call) and broad compatibility (Android 5.0-15+). Critically, XTrace diagnosed over 11 severe online crashes and multiple performance bottlenecks, improving root-cause localization efficiency by over 90%. This confirms XTrace provides a production-grade solution that reconciles the long-standing conflict between stability and comprehensive coverage in Android dynamic tracing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。