allocation

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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"})
)

Functions

func GetRegisteredAllocatorNames

func GetRegisteredAllocatorNames() []string

func MakeNCollectors

func MakeNCollectors(n int, startingIndex int) map[string]*Collector

func MakeNNewTargets

func MakeNNewTargets(n int, numCollectors int, startingIndex int) map[string]*target.Item

func MakeNNewTargetsWithEmptyCollectors

func MakeNNewTargetsWithEmptyCollectors(n int, startingIndex int) map[string]*target.Item

func RecordTargetsKept

func RecordTargetsKept(targets map[string]*target.Item)

func Register

func Register(name string, provider AllocatorProvider) error

Types

type AllocationOption

type AllocationOption func(Allocator)

func WithFilter

func WithFilter(filter Filter) AllocationOption

type Allocator

type Allocator interface {
	SetCollectors(collectors map[string]*Collector)
	SetTargets(targets map[string]*target.Item)
	TargetItems() map[string]*target.Item
	Collectors() map[string]*Collector
	GetTargetsForCollectorAndJob(collector string, job string) []*target.Item
	SetFilter(filter Filter)
}

func New

func New(name string, log logr.Logger, opts ...AllocationOption) (Allocator, error)

type AllocatorProvider

type AllocatorProvider func(log logr.Logger, opts ...AllocationOption) Allocator

type Collector

type Collector struct {
	Name       string
	NumTargets int
}

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

func NewCollector(name string) *Collector

func (Collector) Hash

func (c Collector) Hash() string

func (Collector) String

func (c Collector) String() string

type Filter

type Filter interface {
	Apply(map[string]*target.Item) map[string]*target.Item
}

Jump to

Keyboard shortcuts

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