Documentation ¶
Index ¶
- Variables
- func Flags() *pflag.FlagSet
- func InjectFlags(fs *pflag.FlagSet)
- func IsNoDataError(err error) bool
- func RegisterAsyncCollector(collector string, isDefaultEnabled bool, ...)
- func RegisterCollector(collector string, isDefaultEnabled bool, ...)
- func StartAsyncCollector(ctx context.Context, logger *logrus.Logger) error
- type AsyncCollector
- type Collector
- type EasyCollector
- type Exporter
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
Functions ¶
func InjectFlags ¶ added in v1.0.0
func IsNoDataError ¶
func RegisterAsyncCollector ¶
func RegisterAsyncCollector(collector string, isDefaultEnabled bool, factory func(logger *logrus.Logger) (AsyncCollector, error))
注册 async collector
Types ¶
type AsyncCollector ¶
type AsyncCollector interface { Collector // 阻塞并持续在后台进行异步更新 AsyncCollect(ctx context.Context) error }
AsyncCollector 在后台采集metric并不断更新,在请求到来时返回最新的metric
type Collector ¶
type Collector interface { // 同步获取metrics并通过prometheus registry暴露 Update(ch chan<- prometheus.Metric) error }
Collector 在每次请求到来时才进行采集并生成metric
type EasyCollector ¶
type EasyCollector struct { Collectors map[string]Collector // contains filtered or unexported fields }
func (EasyCollector) Collect ¶
func (s EasyCollector) Collect(ch chan<- prometheus.Metric)
func (EasyCollector) Describe ¶
func (s EasyCollector) Describe(ch chan<- *prometheus.Desc)
type Option ¶ added in v1.1.0
type Option func(*exporterConfig)
func WitContext ¶ added in v1.1.0
func WithLogger ¶ added in v1.1.0
func WithMaxRequests ¶ added in v1.1.0
func WithMetricFilter ¶ added in v1.1.0
func WithMetricPath ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.