inputs

package
v0.0.0-...-5655933 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 20 Imported by: 0

README

inputs

每个采集插件就是一个目录,大家可以点击各个目录进去查看,每个插件的使用方式,都提供了 README 和默认配置,一目了然。如果想贡献插件,可以拷贝 tpl 目录的代码,基于 tpl 做改动。

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InputCreators = map[string]Creator{}

Functions

func Add

func Add(name string, creator Creator)

func Collect

func Collect(e prometheus.Collector, slist *types.SampleList, constLabels ...map[string]string) error

func FormatInputName

func FormatInputName(provider, inputKey string) string

FormatInputName providerName + '.' + inputKey

func MayDrop

func MayDrop(t interface{})

func MayGather

func MayGather(t interface{}, slist *types.SampleList)

func MayInit

func MayInit(t interface{}) error

func ParseInputName

func ParseInputName(name string) (string, string)

ParseInputName parse name into providerName and inputName

Types

type Cloneable

type Cloneable interface {
	Clone() Input
}

type Creator

type Creator func() Input

type Dropper

type Dropper interface {
	Drop()
}

type HTTPProvider

type HTTPProvider struct {
	sync.RWMutex

	RemoteUrl    string
	Headers      []string
	AuthUsername string
	AuthPassword string

	Timeout        int
	ReloadInterval int

	tls.ClientConfig
	// contains filtered or unexported fields
}

HTTPProvider provider a mechanism to get config from remote http server at a fixed interval If input config is changed, the provider will reload the input without reload whole agent

func (*HTTPProvider) GetInputConfig

func (hrp *HTTPProvider) GetInputConfig(inputKey string) ([]cfg.ConfigWithFormat, error)

func (*HTTPProvider) GetInputs

func (hrp *HTTPProvider) GetInputs() ([]string, error)

func (*HTTPProvider) LoadConfig

func (hrp *HTTPProvider) LoadConfig() (bool, error)

func (*HTTPProvider) LoadInputConfig

func (hrp *HTTPProvider) LoadInputConfig(configs []cfg.ConfigWithFormat, input Input) (map[string]Input, error)

func (*HTTPProvider) Name

func (hrp *HTTPProvider) Name() string

func (*HTTPProvider) StartReloader

func (hrp *HTTPProvider) StartReloader()

func (*HTTPProvider) StopReloader

func (hrp *HTTPProvider) StopReloader()

type Initializer

type Initializer interface {
	Init() error
}

type Input

type Input interface {
	Cloneable
	Name() string
	GetLabels() map[string]string
	GetInterval() config.Duration
	InitInternalConfig() error
	Process(*types.SampleList) *types.SampleList
}

type InputOperation

type InputOperation interface {
	RegisterInput(string, []cfg.ConfigWithFormat)
	DeregisterInput(string, string)
}

type Instance

type Instance interface {
	Initialized() bool
	SetInitialized()

	GetLabels() map[string]string
	GetIntervalTimes() int64
	InitInternalConfig() error
	Process(*types.SampleList) *types.SampleList
}

func MayGetInstances

func MayGetInstances(t interface{}) []Instance

type InstancesGetter

type InstancesGetter interface {
	GetInstances() []Instance
}

type LocalProvider

type LocalProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*LocalProvider) GetInputConfig

func (lp *LocalProvider) GetInputConfig(inputKey string) ([]cfg.ConfigWithFormat, error)

func (*LocalProvider) GetInputs

func (lp *LocalProvider) GetInputs() ([]string, error)

func (*LocalProvider) LoadConfig

func (lp *LocalProvider) LoadConfig() (bool, error)

func (*LocalProvider) LoadInputConfig

func (lp *LocalProvider) LoadInputConfig(configs []cfg.ConfigWithFormat, input Input) (map[string]Input, error)

func (*LocalProvider) Name

func (lp *LocalProvider) Name() string

func (*LocalProvider) StartReloader

func (lp *LocalProvider) StartReloader()

StartReloader 内部可以检查是否有配置的变更,如果有变更,则可以手动执行reloadFunc来重启插件

func (*LocalProvider) StopReloader

func (lp *LocalProvider) StopReloader()

type Provider

type Provider interface {
	// Name 用于给input加前缀使用
	Name() string

	// StartReloader Provider初始化后会调用此方法
	// 可以根据需求实现定时加载配置的逻辑
	StartReloader()

	StopReloader()

	// LoadConfig 加载配置的方法,如果配置改变,返回true;提供给 StartReloader 以及 HUP信号的Reload使用
	LoadConfig() (bool, error)

	// GetInputs 获取当前Provider提供了哪些插件
	GetInputs() ([]string, error)

	// GetInputConfig 获取input的配置,注意处理时先判断配置是否在provider中,如果在provider并且读取错误再返回error
	GetInputConfig(inputName string) ([]cfg.ConfigWithFormat, error)

	// 加载 input 的配置
	LoadInputConfig([]cfg.ConfigWithFormat, Input) (map[string]Input, error)
}

Provider InputProvider的抽象,可以实现此抽象来提供个性化的插件配置能力,如从远端定时读取配置等

func NewProvider

func NewProvider(c *config.ConfigType, op InputOperation) ([]Provider, error)

type SampleGatherer

type SampleGatherer interface {
	Gather(*types.SampleList)
}

Directories

Path Synopsis
forked from telegraf https://github.com/influxdata/telegraf/blob/master/plugins/inputs/cloudwatch/sample.conf
forked from telegraf https://github.com/influxdata/telegraf/blob/master/plugins/inputs/cloudwatch/sample.conf
Package docker contains few helper functions copied from https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
Package docker contains few helper functions copied from https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
internal/exporter
Package exporter provides the interface for getting metrics out of mtail, into your monitoring system of choice.
Package exporter provides the interface for getting metrics out of mtail, into your monitoring system of choice.
internal/metrics
Package metrics provides storage for metrics being recorded by mtail programs.
Package metrics provides storage for metrics being recorded by mtail programs.
internal/runtime/code
Package code contains the bytecode instructions for the mtail virtual machine.
Package code contains the bytecode instructions for the mtail virtual machine.
internal/runtime/compiler/opt
package opt has a compiler pass for making optimisations on the AST.
package opt has a compiler pass for making optimisations on the AST.
internal/runtime/compiler/parser
Package parser implements the parse phase of the mtail program compilation.
Package parser implements the parse phase of the mtail program compilation.
internal/runtime/compiler/position
Package position implements a data structure for storing source code positions.
Package position implements a data structure for storing source code positions.
internal/runtime/vm
Package vm provides a virtual machine environment for executing mtail bytecode.
Package vm provides a virtual machine environment for executing mtail bytecode.
internal/tailer
Package tailer provides a class that is responsible for tailing log files and extracting new log lines to be passed into the virtual machines.
Package tailer provides a class that is responsible for tailing log files and extracting new log lines to be passed into the virtual machines.
internal/tailer/logstream
Package logstream provides an interface and implementations of log source streaming.
Package logstream provides an interface and implementations of log source streaming.
internal/testutil
Reimport the go-cmp package as the name 'cmp' conflicts with the cmp instruction in the vm.
Reimport the go-cmp package as the name 'cmp' conflicts with the cmp instruction in the vm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL