Documentation ¶
Index ¶
- func BuildCacheTag(prefix string, val ...interface{}) *string
- func GetList() map[string]*Collector
- func HttpWaitForRlock(handler http.Handler) http.Handler
- func Lock() *sync.RWMutex
- type Collector
- func (c *Collector) DisableCache()
- func (c *Collector) EnableCache(cache string, cacheTag *string)
- func (c *Collector) GetConcurrency() int
- func (c *Collector) GetContext() context.Context
- func (c *Collector) GetCronSpec() *string
- func (c *Collector) GetData(name string) interface{}
- func (c *Collector) GetLastScapeTime() *time.Time
- func (c *Collector) GetLastScrapeDuration() *time.Duration
- func (c *Collector) GetMetricList(name string) *MetricList
- func (c *Collector) GetNextScrapeTime() *time.Time
- func (c *Collector) GetPanicBackoff() []time.Duration
- func (c *Collector) GetPanicThreshold() int64
- func (c *Collector) GetPrometheusRegistry() *prometheus.Registry
- func (c *Collector) GetScapeTime() *time.Duration
- func (c *Collector) IsEnabled() (status bool)
- func (c *Collector) RegisterMetricList(name string, vec interface{}, reset bool) *MetricList
- func (c *Collector) SetCache(cache *string, cacheTag *string)
- func (c *Collector) SetConcurrency(concurrency int)
- func (c *Collector) SetContext(ctx context.Context)
- func (c *Collector) SetCronSpec(cron *cron.Cron, cronSpec string)
- func (c *Collector) SetData(name string, val interface{})
- func (c *Collector) SetNextSleepDuration(sleepDuration time.Duration)
- func (c *Collector) SetPanicBackoff(val ...time.Duration)
- func (c *Collector) SetPanicThreshold(threshold int64)
- func (c *Collector) SetPrometheusRegistry(registry *prometheus.Registry)
- func (c *Collector) SetScapeTime(scrapeTime time.Duration)
- func (c *Collector) Start() error
- type CollectorData
- type MetricList
- type Processor
- type ProcessorInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCacheTag ¶
BuildCacheTag builds a cache tag based on prefix string and various interfaces, returns a tag value (string)
Types ¶
type Collector ¶
type Collector struct { Name string // contains filtered or unexported fields }
func New ¶
func New(name string, processor ProcessorInterface, logger *zap.SugaredLogger) *Collector
New creates new collector
func (*Collector) DisableCache ¶
func (c *Collector) DisableCache()
DisableCache disables all caching
func (*Collector) EnableCache ¶
EnableCache alias of SetCache
func (*Collector) GetConcurrency ¶
GetConcurrency returns global collector concurrency
func (*Collector) GetContext ¶
GetContext returns collector context
func (*Collector) GetCronSpec ¶
GetCronSpec return cronspec (if set)
func (*Collector) GetLastScapeTime ¶
GetLastScapeTime returns last scrape time
func (*Collector) GetLastScrapeDuration ¶
GetLastScrapeDuration returns last scrape duration
func (*Collector) GetMetricList ¶
func (c *Collector) GetMetricList(name string) *MetricList
GetMetricList returns managed metric vec
func (*Collector) GetNextScrapeTime ¶
GetNextScrapeTime returns next scrape time
func (*Collector) GetPanicBackoff ¶
GetPanicBackoff returns panic backoff durations
func (*Collector) GetPanicThreshold ¶
GetPanicThreshold returns panic threshold count
func (*Collector) GetPrometheusRegistry ¶
func (c *Collector) GetPrometheusRegistry() *prometheus.Registry
GetPrometheusRegistry returns prometheus metric registry
func (*Collector) GetScapeTime ¶
GetScapeTime return scrape time
func (*Collector) IsEnabled ¶
IsEnabled returns if all requirements are fulfilled to start collector
func (*Collector) RegisterMetricList ¶
func (c *Collector) RegisterMetricList(name string, vec interface{}, reset bool) *MetricList
RegisterMetricList register new managed prometheus metric vec
func (*Collector) SetCache ¶
SetCache enables caching of collector with local file and azblob support
cache can be specified as local file or storageaccount blob: path or file://path/to/file will store cached metrics in file azblob://storageaccount.blob.core.windows.net/container/blob will store cached metrics in storageaccount cacheTag is used to force restore, if nil cacheTag is ignored and otherwise enforced
func (*Collector) SetConcurrency ¶
SetConcurrency set global concurrency for collector
func (*Collector) SetContext ¶
SetContext set context of collector
func (*Collector) SetCronSpec ¶
SetCronSpec sets cronspec for collector (using cron for schedule)
func (*Collector) SetNextSleepDuration ¶
SetNextSleepDuration set next sleep duration for next run
func (*Collector) SetPanicBackoff ¶
SetPanicBackoff set backoff duration for panics
func (*Collector) SetPanicThreshold ¶
SetPanicThreshold set threshold of panics in a row until panics are thrown
func (*Collector) SetPrometheusRegistry ¶
func (c *Collector) SetPrometheusRegistry(registry *prometheus.Registry)
SetPrometheusRegistry set prometheus metric registry
func (*Collector) SetScapeTime ¶
SetScapeTime set fixed scrape time in time.Duration
type CollectorData ¶
type CollectorData struct { // metric lists Metrics map[string]*MetricList `json:"metrics"` // custom data Data map[string]interface{} `json:"data"` // only used for debugging purposes Created *time.Time `json:"created"` // used for cache expiry Expiry *time.Time `json:"expiry"` // used for reload enforcement if tag mismatches Tag *string `json:"tag"` }
func NewCollectorData ¶
func NewCollectorData() *CollectorData
NewCollectorData creates new collector data struct
type MetricList ¶
type MetricList struct { *prometheusCommon.MetricList // contains filtered or unexported fields }
type Processor ¶
type Processor struct {
Collector *Collector
}
func (*Processor) GetLastScapeTime ¶
func (*Processor) Logger ¶
func (p *Processor) Logger() *zap.SugaredLogger
func (*Processor) WaitGroup ¶
func (p *Processor) WaitGroup() *sizedwaitgroup.SizedWaitGroup
type ProcessorInterface ¶
type ProcessorInterface interface { Setup(collector *Collector) Reset() Collect(callback chan<- func()) }