Documentation
¶
Index ¶
- Variables
- func GetRegisteredAllocatorNames() []string
- func MakeNCollectors(n int, startingIndex int) map[string]*Collector
- func MakeNNewTargets(n int, numCollectors int, startingIndex int) []*target.Item
- func MakeNNewTargetsWithEmptyCollectors(n int, startingIndex int) []*target.Item
- func RecordTargetsKept(targets []*target.Item)
- func RunForAllStrategies(t *testing.T, f func(t *testing.T, allocator Allocator))
- type Allocator
- type AllocatorProvider
- type Collector
- type Filter
- type Option
- type Strategy
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TargetsPerCollector records how many targets have been assigned to each collector. // It is currently the responsibility of the strategy to track this information. TargetsPerCollector = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "opentelemetry_allocator_targets_per_collector", Help: "The number of targets for each collector.", }, []string{"collector_name", "strategy"}) CollectorsAllocatable = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "opentelemetry_allocator_collectors_allocatable", Help: "Number of collectors the allocator is able to allocate to.", }, []string{"strategy"}) TimeToAssign = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "opentelemetry_allocator_time_to_allocate", Help: "The time it takes to allocate", }, []string{"method", "strategy"}) TargetsRemaining = promauto.NewGauge(prometheus.GaugeOpts{ Name: "opentelemetry_allocator_targets_remaining", Help: "Number of targets kept after filtering.", }) TargetsUnassigned = promauto.NewGauge(prometheus.GaugeOpts{ Name: "opentelemetry_allocator_targets_unassigned", Help: "Number of targets that could not be assigned due to missing node label.", }) )
Functions ¶
func GetRegisteredAllocatorNames ¶
func GetRegisteredAllocatorNames() []string
func MakeNNewTargets ¶
func RecordTargetsKept ¶
Types ¶
type Allocator ¶
type Allocator interface {
SetCollectors(collectors map[string]*Collector)
SetTargets(targets []*target.Item)
TargetItems() map[target.ItemHash]*target.Item
Collectors() map[string]*Collector
GetTargetsForCollectorAndJob(collector string, job string) []*target.Item
SetFilter(filter Filter)
SetFallbackStrategy(strategy Strategy)
}
type Collector ¶
Collector Creates a struct that holds Collector information. This struct will be parsed into endpoint with Collector and jobs info. This struct can be extended with information like annotations and labels in the future.
func NewCollector ¶
type Strategy ¶
type Strategy interface {
GetCollectorForTarget(map[string]*Collector, *target.Item) (*Collector, error)
// SetCollectors exists for strategies where changing the collector set is potentially an expensive operation.
// The caller must guarantee that the collectors map passed in GetCollectorForTarget is consistent with the latest
// SetCollectors call. Strategies which don't need this information can just ignore it.
SetCollectors(map[string]*Collector)
GetName() string
// SetFallbackStrategy adds fallback strategy for strategies whose main allocation method can sometimes leave targets unassigned
SetFallbackStrategy(Strategy)
}
Click to show internal directories.
Click to hide internal directories.