X-Profiler / xprofiler

🌀An addon for node.js, which supporting output performance log and real-time profiling through sampling.
Other
422 stars 57 forks source link

feat: support http profiling #215

Closed hyj1991 closed 1 year ago

hyj1991 commented 1 year ago

背景

生产环境中当应用路由复杂度比较高时,仅靠 cpuprofile 只能看到离散的函数调用栈,特别是一些底层的例如 db 操作库无法映射到对应的逻辑,从而使得性能问题分析变得棘手。

方案

本 PR 增加了一个 enable_http_profiling 参数,默认为 false。其开启后,会在 CPU Profiling 时同步执行 HTTP Profiling,这样可以将 CPU 采样按照时间维度的分析结果,和同一时刻的 HTTP 请求信息进行比对,从而缩小性能问题的定位范围。

close #213

fengmk2 commented 1 year ago

越来越高级了。

hyj1991 commented 1 year ago

越来越高级了。

贴合语雀业务的性能问题,反馈到工具链上的一个 Case

codecov[bot] commented 1 year ago

Codecov Report

Merging #215 (78a1704) into master (85065b8) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 78a1704 differs from pull request most recent head a4f0183. Consider uploading reports for the commit a4f0183 to get more accurate results

@@            Coverage Diff            @@
##            master      #215   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          305       317   +12     
=========================================
+ Hits           305       317   +12     
Impacted Files Coverage Δ
lib/configure.js 100.00% <100.00%> (ø)
lib/utils.js 100.00% <100.00%> (ø)
patch/http.js 100.00% <100.00%> (ø)
xprofiler.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more