{"modulePath":"github.com/netdata/go.d.plugin","version":"v0.58.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package module\n\n## Constants\n\n```go\nconst (\n\t// Line chart type.\n\tLine ChartType = \"line\"\n\t// Area chart type.\n\tArea ChartType = \"area\"\n\t// Stacked chart type.\n\tStacked ChartType = \"stacked\"\n\n\t// Absolute dimension algorithm.\n\t// The value is to drawn as-is (interpolated to second boundary).\n\tAbsolute DimAlgo = \"absolute\"\n\t// Incremental dimension algorithm.\n\t// The value increases over time, the difference from the last value is presented in the chart,\n\t// the server interpolates the value and calculates a per second figure.\n\tIncremental DimAlgo = \"incremental\"\n\t// PercentOfAbsolute dimension algorithm.\n\t// The percent of this value compared to the total of all dimensions.\n\tPercentOfAbsolute DimAlgo = \"percentage-of-absolute-row\"\n\t// PercentOfIncremental dimension algorithm.\n\t// The percent of this value compared to the incremental total of all dimensions\n\tPercentOfIncremental DimAlgo = \"percentage-of-incremental-row\"\n)\n```\n\n```go\nconst (\n\tLabelSourceAuto = 1 \u003c\u003c 0\n\tLabelSourceConf = 1 \u003c\u003c 1\n\tLabelSourceK8s  = 1 \u003c\u003c 2\n)\n```\n\n```go\nconst (\n\tUpdateEvery        = 1\n\tAutoDetectionRetry = 0\n\tPriority           = 70000\n)\n```\n\n```go\nconst NetdataChartIDMaxLength = 1000\n```\nNetdataChartIDMaxLength is the chart ID max length. See RRD\\_ID\\_LENGTH\\_MAX in the netdata source code.\n\n## Variables\n\n```go\nvar DefaultRegistry = Registry{}\n```\nDefaultRegistry DefaultRegistry.\n\n## Functions\n\n```go\nfunc DontObsoleteCharts()\n```\n\n```go\nfunc Register(name string, creator Creator)\n```\nRegister registers a module in the DefaultRegistry.\n\n## Types\n\n```go\ntype Base struct {\n\t*logger.Logger\n}\n```\nBase is a helper struct. All modules should embed this struct.\n\n```go\nfunc (b *Base) GetBase() *Base\n```\n\n```go\ntype Chart struct {\n\tOverModule string\n\tIDSep      bool\n\tID         string\n\tOverID     string\n\tTitle      string\n\tUnits      string\n\tFam        string\n\tCtx        string\n\tType       ChartType\n\tPriority   int\n\tOpts\n\n\tLabels []Label\n\tDims   Dims\n\tVars   Vars\n\n\tRetries int\n\t// contains filtered or unexported fields\n}\n```\nChart represents a chart. For the full description please visit [https://docs.netdata.cloud/collectors/plugins.d/#chart](https://docs.netdata.cloud/collectors/plugins.d/#chart)\n\n```go\nfunc (c *Chart) AddDim(newDim *Dim) error\n```\nAddDim adds new dimension to the chart dimensions.\n\n```go\nfunc (c *Chart) AddVar(newVar *Var) error\n```\nAddVar adds new variable to the chart variables.\n\n```go\nfunc (c Chart) Copy() *Chart\n```\nCopy returns a deep copy of the chart.\n\n```go\nfunc (c *Chart) GetDim(dimID string) *Dim\n```\nGetDim returns dimension by ID.\n\n```go\nfunc (c Chart) HasDim(dimID string) bool\n```\nHasDim returns true if the chart contains dimension with the given ID, false otherwise.\n\n```go\nfunc (c *Chart) MarkDimRemove(dimID string, hide bool) error\n```\nMarkDimRemove sets 'remove' flag, Obsolete and optionally Hidden options to true. Use it to remove dimension in runtime.\n\n```go\nfunc (c *Chart) MarkNotCreated()\n```\nMarkNotCreated changes 'created' chart flag to false. Use it to add dimension in runtime.\n\n```go\nfunc (c *Chart) MarkRemove()\n```\nMarkRemove sets 'remove' flag and Obsolete option to true. Use it to remove chart in runtime.\n\n```go\nfunc (c *Chart) RemoveDim(dimID string) error\n```\nRemoveDim removes dimension by ID. Avoid to use it in runtime.\n\n```go\ntype ChartType string\n```\n\n```go\nfunc (c ChartType) String() string\n```\n\n```go\ntype Charts []*Chart\n```\nCharts is a collection of Charts.\n\n```go\nfunc (c *Charts) Add(charts ...*Chart) error\n```\nAdd adds (appends) a variable number of Charts.\n\n```go\nfunc (c Charts) Copy() *Charts\n```\nCopy returns a deep copy of ChartsFunc.\n\n```go\nfunc (c Charts) Get(chartID string) *Chart\n```\nGet returns the chart by ID.\n\n```go\nfunc (c Charts) Has(chartID string) bool\n```\nHas returns true if ChartsFunc contain the chart with the given ID, false otherwise.\n\n```go\nfunc (c *Charts) Remove(chartID string) error\n```\nRemove removes the chart from Charts by ID. Avoid to use it in runtime.\n\n```go\ntype Creator struct {\n\tDefaults\n\tCreate          func() Module\n\tJobConfigSchema string\n}\n```\nCreator is a Job builder.\n\n```go\ntype Defaults struct {\n\tUpdateEvery        int\n\tAutoDetectionRetry int\n\tPriority           int\n\tDisabled           bool\n}\n```\nDefaults is a set of module default parameters.\n\n```go\ntype Dim struct {\n\tID   string\n\tName string\n\tAlgo DimAlgo\n\tMul  int\n\tDiv  int\n\tDimOpts\n\t// contains filtered or unexported fields\n}\n```\nDim represents a chart dimension. For detailed description please visit [https://docs.netdata.cloud/collectors/plugins.d/#dimension](https://docs.netdata.cloud/collectors/plugins.d/#dimension).\n\n```go\ntype DimAlgo string\n```\n\n```go\nfunc (d DimAlgo) String() string\n```\n\n```go\ntype DimOpts struct {\n\tObsolete   bool\n\tHidden     bool\n\tNoReset    bool\n\tNoOverflow bool\n}\n```\nDimOpts represents dimension options.\n\n```go\nfunc (o DimOpts) String() string\n```\n\n```go\ntype Dims []*Dim\n```\nDims is a collection of dims.\n\n```go\ntype Job struct {\n\tAutoDetectEvery int\n\tAutoDetectTries int\n\n\t*logger.Logger\n\t// contains filtered or unexported fields\n}\n```\nJob represents a job. It's a module wrapper.\n\n```go\nfunc NewJob(cfg JobConfig) *Job\n```\n\n```go\nfunc (j *Job) AutoDetection() (ok bool)\n```\nAutoDetection invokes init, check and postCheck. It handles panic.\n\n```go\nfunc (j Job) AutoDetectionEvery() int\n```\nAutoDetectionEvery returns value of AutoDetectEvery.\n\n```go\nfunc (j *Job) Cleanup()\n```\n\n```go\nfunc (j Job) FullName() string\n```\nFullName returns job full name.\n\n```go\nfunc (j Job) ModuleName() string\n```\nModuleName returns job module name.\n\n```go\nfunc (j Job) Name() string\n```\nName returns job name.\n\n```go\nfunc (j Job) Panicked() bool\n```\nPanicked returns 'panicked' flag value.\n\n```go\nfunc (j Job) RetryAutoDetection() bool\n```\nRetryAutoDetection returns whether it is needed to retry autodetection.\n\n```go\nfunc (j *Job) Start()\n```\nStart starts job main loop.\n\n```go\nfunc (j *Job) Stop()\n```\nStop stops job main loop. It blocks until the job is stopped.\n\n```go\nfunc (j *Job) Tick(clock int)\n```\nTick Tick.\n\n```go\ntype JobConfig struct {\n\tPluginName      string\n\tName            string\n\tModuleName      string\n\tFullName        string\n\tModule          Module\n\tLabels          map[string]string\n\tOut             io.Writer\n\tUpdateEvery     int\n\tAutoDetectEvery int\n\tPriority        int\n\tIsStock         bool\n\n\tVnodeGUID     string\n\tVnodeHostname string\n\tVnodeLabels   map[string]string\n}\n```\n\n```go\ntype Label struct {\n\tKey    string\n\tValue  string\n\tSource int\n}\n```\n\n```go\ntype MockModule struct {\n\tBase\n\n\tInitFunc    func() bool\n\tCheckFunc   func() bool\n\tChartsFunc  func() *Charts\n\tCollectFunc func() map[string]int64\n\tCleanupFunc func()\n\tCleanupDone bool\n}\n```\nMockModule MockModule.\n\n```go\nfunc (m MockModule) Charts() *Charts\n```\nCharts invokes ChartsFunc.\n\n```go\nfunc (m MockModule) Check() bool\n```\nCheck invokes CheckFunc.\n\n```go\nfunc (m *MockModule) Cleanup()\n```\nCleanup sets CleanupDone to true.\n\n```go\nfunc (m MockModule) Collect() map[string]int64\n```\nCollect invokes CollectDunc.\n\n```go\nfunc (m MockModule) Init() bool\n```\nInit invokes InitFunc.\n\n```go\ntype Module interface {\n\t// Init does initialization.\n\t// If it returns false, the job will be disabled.\n\tInit() bool\n\n\t// Check is called after Init.\n\t// If it returns false, the job will be disabled.\n\tCheck() bool\n\n\t// Charts returns the chart definition.\n\t// Make sure not to share returned instance.\n\tCharts() *Charts\n\n\t// Collect collects metrics.\n\tCollect() map[string]int64\n\n\t// Cleanup Cleanup\n\tCleanup()\n\n\tGetBase() *Base\n}\n```\nModule is an interface that represents a module.\n\n```go\ntype Opts struct {\n\tObsolete   bool\n\tDetail     bool\n\tStoreFirst bool\n\tHidden     bool\n}\n```\nOpts represents chart options.\n\n```go\nfunc (o Opts) String() string\n```\n\n```go\ntype Registry map[string]Creator\n```\nRegistry is a collection of Creators.\n\n```go\nfunc (r Registry) Register(name string, creator Creator)\n```\nRegister registers a module.\n\n```go\ntype Var struct {\n\tID    string\n\tName  string\n\tValue int64\n}\n```\nVar represents a chart variable. For detailed description please visit [https://docs.netdata.cloud/collectors/plugins.d/#variable](https://docs.netdata.cloud/collectors/plugins.d/#variable)\n\n```go\ntype Vars []*Var\n```\nVars is a collection of vars.\n\n","path":"github.com/netdata/go.d.plugin/agent/module","name":"module","synopsis":"","isRedistributable":true}
