Documentation
¶
Index ¶
- Constants
- Variables
- func CheckCharts(charts ...*Chart) error
- func Register(name string, creator Creator)
- type Base
- type Chart
- func (c *Chart) AddDim(newDim *Dim) error
- func (c *Chart) AddVar(newVar *Var) error
- func (c Chart) Copy() *Chart
- func (c *Chart) GetDim(dimID string) *Dim
- func (c Chart) HasDim(dimID string) bool
- func (c *Chart) MarkNotCreated()
- func (c *Chart) MarkRemove()
- func (c *Chart) RemoveDim(dimID string) error
- type Charts
- type Creator
- type Dim
- type Dims
- type Job
- func (j Job) AutoDetectionRetry() int
- func (j *Job) Check() bool
- func (j Job) FullName() string
- func (j *Job) Init() bool
- func (j *Job) MainLoop()
- func (j Job) ModuleName() string
- func (j Job) Name() string
- func (j Job) Panicked() bool
- func (j *Job) PostCheck() bool
- func (j *Job) Start()
- func (j *Job) Stop()
- func (j *Job) Tick(clock int)
- type MockModule
- type Module
- type Observer
- type Opts
- type Registry
- type Var
- type Vars
Constants ¶
const ( // Line chart type. Line chartType = "line" // Area chart type. Area chartType = "area" // Stacked chart type. Stacked chartType = "stacked" // Absolute dimension algorithm. // The value is to drawn as-is (interpolated to second boundary). Absolute dimAlgo = "absolute" // Incremental dimension algorithm. // The value increases over time, the difference from the last value is presented in the chart, // the server interpolates the value and calculates a per second figure. Incremental dimAlgo = "incremental" // PercentOfAbsolute dimension algorithm. // The percent of this value compared to the total of all dimensions. PercentOfAbsolute dimAlgo = "percentage-of-absolute-row" // PercentOfIncremental dimension algorithm. // The percent of this value compared to the incremental total of all dimensions PercentOfIncremental dimAlgo = "percentage-of-incremental-row" )
Variables ¶
var DefaultRegistry = Registry{}
DefaultRegistry DefaultRegistry
Functions ¶
Types ¶
type Chart ¶
type Chart struct {
ID string
OverID string
Title string
Units string
Fam string
Ctx string
Type chartType
Priority int
Opts
Dims Dims
Vars Vars
Retries int
// contains filtered or unexported fields
}
Chart represents a chart. For the full description please visit https://docs.netdata.cloud/collectors/plugins.d/#chart
func (Chart) HasDim ¶
HasDim returns true if the chart contains dimension with the given ID, false otherwise.
func (*Chart) MarkNotCreated ¶
func (c *Chart) MarkNotCreated()
MarkNotCreated changes 'created' chart flag to false. Use it to add dimension in runtime.
func (*Chart) MarkRemove ¶
func (c *Chart) MarkRemove()
MarkRemove changes 'remove' chart flag to true. Use it to remove chart in runtime.
type Charts ¶
type Charts []*Chart
Charts is a collection of ChartsFunc.
type Dim ¶
Dim represents a chart dimension. For detailed description please visit https://docs.netdata.cloud/collectors/plugins.d/#dimension.
type Job ¶
type Job struct {
*logger.Logger
Nam string `yaml:"name"`
UpdateEvery int `yaml:"update_every" validate:"gte=1"`
AutoDetectRetry int `yaml:"autodetection_retry" validate:"gte=0"`
// contains filtered or unexported fields
}
Job represents a job. It's a module wrapper.
func (Job) AutoDetectionRetry ¶
AutoDetectionRetry returns value of AutoDetectRetry.
func (*Job) Check ¶
Check calls module Check and returns its value. It handles panic. In case of panic it calls module Cleanup.
func (Job) FullName ¶
FullName returns full name. If name isn't specified or equal to module name it returns module name.
type MockModule ¶
type MockModule struct {
Base
InitFunc func() bool
CheckFunc func() bool
ChartsFunc func() *Charts
CollectFunc func() map[string]int64
CleanupDone bool
}
MockModule MockModule
func (MockModule) Collect ¶
func (m MockModule) Collect() map[string]int64
Collect invokes CollectDunc
type Module ¶
type Module interface {
// Init does initialization.
// If it return false, the job will be disabled.
Init() bool
// Check is called after Init.
// If it return false, the job will be disabled.
Check() bool
// Charts returns the chart definition.
// Make sure not to share returned instance.
Charts() *Charts
// Collect collects metrics.
Collect() map[string]int64
// SetLogger SetLogger
SetLogger(l *logger.Logger)
// Cleanup Cleanup
Cleanup()
}
Module is an interface that represents a module.
type Var ¶
Var represents a chart variable. For detailed description please visit https://docs.netdata.cloud/collectors/plugins.d/#variable