1234567891011121314151617181920212223242526272829303132333435363738 |
- package mhayaGops
- import (
- "github.com/google/gops/agent"
- mhayaFacade "github.com/mhaya/facade"
- mhayaLogger "github.com/mhaya/logger"
- )
- // Component gops 监听进程数据
- type Component struct {
- mhayaFacade.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 {
- mhayaLogger.Error(err)
- }
- }
- func (c *Component) OnAfterInit() {
- }
- func (c *Component) OnStop() {
- //agent.Close()
- }
|