| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package cherryGops
- import (
- cherryFacade "github.com/cherry-game/cherry/facade"
- clog "github.com/cherry-game/cherry/logger"
- "github.com/google/gops/agent"
- )
- // Component gops 监听进程数据
- type Component struct {
- cherryFacade.Component
- options agent.Options
- }
- func New(options ...agent.Options) *Component {
- component := &Component{}
- if len(options) > 0 {
- component.options = options[0]
- }
- return component
- }
- func (c *Component) Name() string {
- return "gops_component"
- }
- func (c *Component) Init() {
- if err := agent.Listen(c.options); err != nil {
- clog.Error(err)
- }
- }
- func (c *Component) OnAfterInit() {
- }
- func (c *Component) OnStop() {
- //agent.Close()
- }
- func TestLoad() {
- if err := agent.Listen(agent.Options{
- Addr: "",
- ConfigDir: "",
- ShutdownCleanup: false,
- ReuseSocketAddrAndPort: false,
- }); err != nil {
- clog.Error(err)
- }
- }
|