Documentation
¶
Index ¶
- Constants
- func ValidatePollAtomic(val any) error
- func ValidatePollFunc(fn any) error
- func ValidatePollSync(lock sync.Locker, val any) error
- type WatchCollector
- func (wc *WatchCollector) AddRegError(err ds.ErrWithContext)
- func (wc *WatchCollector) CollectWatches()
- func (wc *WatchCollector) CollectorName() string
- func (wc *WatchCollector) Disable()
- func (wc *WatchCollector) Enable()
- func (wc *WatchCollector) GetRegErrors() []ds.ErrWithContext
- func (wc *WatchCollector) GetStatus() ds.CollectorStatus
- func (wc *WatchCollector) GetWatchNames() []string
- func (wc *WatchCollector) InitCollector(controller ds.Controller, cfg any, arCtx ds.AppRunContext) error
- func (wc *WatchCollector) PushWatchSample(name string, val any)
- func (wc *WatchCollector) RegisterWatchDecl(decl *ds.WatchDecl)
- func (wc *WatchCollector) SetNextSendFull(full bool)
- func (wc *WatchCollector) UnregisterWatch(decl *ds.WatchDecl)
Constants ¶
const ( WatchFormat_Json = "json" WatchFormat_Stringer = "stringer" WatchFormat_Gofmt = "gofmt" WatchType_Sync = "sync" WatchType_Atomic = "atomic" WatchType_Func = "func" WatchType_Push = "push" )
const MaxWatchVals = 10000
const MaxWatchWaitTime = 10 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
func ValidatePollAtomic ¶ added in v0.5.0
ValidatePollAtomic validates that the provided value is suitable for use as an atomic poll value. A valid atomic poll value must: - Be non-nil - Be a pointer - Point to a valid atomic type (sync/atomic package types or primitive types that support atomic operations)
func ValidatePollFunc ¶ added in v0.5.0
ValidatePollFunc validates that the provided function is suitable for use as a poll function. A valid poll function must: - Be non-nil - Be a function - Take 0 arguments - Return exactly 1 value
func ValidatePollSync ¶ added in v0.5.0
ValidatePollSync validates that the provided lock and value are suitable for use in a sync-based watch. A valid sync poll setup must have: - A non-nil sync.Locker - A non-nil value - The value must be a pointer
Types ¶
type WatchCollector ¶
type WatchCollector struct {
// contains filtered or unexported fields
}
WatchCollector implements the collector.Collector interface for watch collection
func GetInstance ¶
func GetInstance() *WatchCollector
GetInstance returns the singleton instance of WatchCollector
func (*WatchCollector) AddRegError ¶ added in v0.5.0
func (wc *WatchCollector) AddRegError(err ds.ErrWithContext)
func (*WatchCollector) CollectWatches ¶
func (wc *WatchCollector) CollectWatches()
CollectWatches collects watch information and sends it to the controller note we do not hold the lock for the duration of this function
func (*WatchCollector) CollectorName ¶
func (wc *WatchCollector) CollectorName() string
CollectorName returns the unique name of the collector
func (*WatchCollector) Enable ¶
func (wc *WatchCollector) Enable()
Enable is called when the collector should start collecting data
func (*WatchCollector) GetRegErrors ¶ added in v0.5.0
func (wc *WatchCollector) GetRegErrors() []ds.ErrWithContext
GetRegErrors returns a copy of the registration errors
func (*WatchCollector) GetStatus ¶ added in v0.5.16
func (wc *WatchCollector) GetStatus() ds.CollectorStatus
GetStatus returns the current status of the watch collector
func (*WatchCollector) GetWatchNames ¶
func (wc *WatchCollector) GetWatchNames() []string
func (*WatchCollector) InitCollector ¶
func (wc *WatchCollector) InitCollector(controller ds.Controller, cfg any, arCtx ds.AppRunContext) error
InitCollector initializes the watch collector with a controller and configuration
func (*WatchCollector) PushWatchSample ¶ added in v0.5.0
func (wc *WatchCollector) PushWatchSample(name string, val any)
func (*WatchCollector) RegisterWatchDecl ¶ added in v0.5.0
func (wc *WatchCollector) RegisterWatchDecl(decl *ds.WatchDecl)
RegisterWatchDecl registers a watch declaration in the watchDecls map Returns an error if a watch with the same name already exists
func (*WatchCollector) SetNextSendFull ¶ added in v0.5.0
func (wc *WatchCollector) SetNextSendFull(full bool)
SetNextSendFull sets the nextSendFull flag to force a full update on the next dump
func (*WatchCollector) UnregisterWatch ¶
func (wc *WatchCollector) UnregisterWatch(decl *ds.WatchDecl)