🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More
Socket
Book a DemoInstallSign in
Socket

m7s.live/plugin/debug/v4

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

m7s.live/plugin/debug/v4

Go Modules
Version
v4.0.3
Version published
Created
Source

debug插件

该插件可以使得pprof通过公共端口访问,并且调用profile可以将CPU分析文件保存为cpu.profile文件,然后自动打开分析UI界面。

插件地址

https://github.com/Monibuca/plugin-debug

插件引入

import (
    _ "m7s.live/plugin/debug/v4"
)

API

GET /debug/pprof

打开pprof界面

GET /debug/profile

默认30s采样,可以通过传入 ?seconds=xxx 来指定采样时间长度,采样结束后将CPU分析文件保存为cpu.profile文件,并将启动采样展示 web 页面的命令输出到当前页面。比如 go tool pprof -http :6060 ./monibuca cpu.profile

在当前monibuca程序目录下,运行命令会自动打开浏览器,展示 profile 调用图。注意需要先安装graphviz,并添加到环境变量PATH里。

GET /debug/charts

展示 CPU、内存、GC、pprof 实时变化可视化图表

WS /debug/charts/datafeed

ws 接口,供/debug/charts页面前端拉取数据,不需关心

GET /debug/charts/data

jquery 回调接口,供/debug/charts页面前端拉取数据,不需关心

FAQs

Package last updated on 06 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts