github.com/netdata/go.d.plugin@v0.58.1/agent/module/module.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package module
     4  
     5  import (
     6  	"github.com/netdata/go.d.plugin/logger"
     7  )
     8  
     9  // Module is an interface that represents a module.
    10  type Module interface {
    11  	// Init does initialization.
    12  	// If it returns false, the job will be disabled.
    13  	Init() bool
    14  
    15  	// Check is called after Init.
    16  	// If it returns false, the job will be disabled.
    17  	Check() bool
    18  
    19  	// Charts returns the chart definition.
    20  	// Make sure not to share returned instance.
    21  	Charts() *Charts
    22  
    23  	// Collect collects metrics.
    24  	Collect() map[string]int64
    25  
    26  	// Cleanup Cleanup
    27  	Cleanup()
    28  
    29  	GetBase() *Base
    30  }
    31  
    32  // Base is a helper struct. All modules should embed this struct.
    33  type Base struct {
    34  	*logger.Logger
    35  }
    36  
    37  func (b *Base) GetBase() *Base { return b }