coordinator

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator periodically re balance all replicates

func NewCoordinator

func NewCoordinator(
	option *Option,
	reManager shard.ReplicasManager,
	getConfig func() *prom.ConfigInfo,
	getExploreResult func(hash uint64) *target.ScrapeStatus,
	getActive func() map[uint64]*discovery.SDTargets,
	promRegisterer prometheus.Registerer,
	log logrus.FieldLogger,
) *Coordinator

NewCoordinator create a new coordinator service

func (*Coordinator) LastGlobalScrapeStatus added in v0.0.5

func (c *Coordinator) LastGlobalScrapeStatus() map[uint64]*target.ScrapeStatus

LastGlobalScrapeStatus return the last scraping status of all targets

func (*Coordinator) Run

func (c *Coordinator) Run(ctx context.Context) error

Run do coordinate periodically until ctx done

type ExtendTarget added in v0.1.5

type ExtendTarget struct {
	// Target is Prometheus active target from /api/v1/targets
	v1.Target
	// Series is the avg series of last 5 scraping results
	Series int64 `json:"series"`
	// Shards contains ID of shards that is scraping this target
	Shards []string `json:"shards"`
}

ExtendTarget extend Prometheus v1.Target

type Option added in v0.1.5

type Option struct {
	// MaxSeries is max series every shard can assign
	MaxSeries int64
	// MaxShard is the max number we can scale up to
	MaxShard int32
	// MinShard is the min shard number that coordinator need
	// Coordinator will change scale to MinShard if current shard number < MinShard
	MinShard int32
	// MaxIdleTime indicate how long to wait when one shard has no target is scraping
	MaxIdleTime time.Duration
	// Period is the interval between every coordinating
	Period time.Duration
	// DisableAlleviate disable shard alleviation when shard is overload
	DisableAlleviate bool
}

Option indicate all coordinate arguments

type Service added in v0.0.3

type Service struct {
	// gin.Engine is the gin engine for handle http request
	*gin.Engine
	// contains filtered or unexported fields
}

Service is the api server of coordinator

func NewService added in v0.0.3

func NewService(
	configFile string,
	cfgManager *prom.ConfigManager,
	getScrapeStatus func() map[uint64]*target.ScrapeStatus,
	getActiveTargets func() map[string][]*discovery.SDTargets,
	getDropTargets func() map[string][]*discovery.SDTargets,
	promRegistry *prometheus.Registry,
	lg logrus.FieldLogger) *Service

NewService return a new web server

type TargetDiscovery added in v0.1.3

type TargetDiscovery struct {
	// ActiveTargets contains all targets that should be scraped
	ActiveTargets []*ExtendTarget `json:"activeTargets"`
	// ActiveStatistics contains job's statistics number according to target health
	ActiveStatistics []TargetStatistics `json:"activeStatistics,omitempty"`
	// DroppedTargets contains all targets that been dropped from relabel
	DroppedTargets []*v1.DroppedTarget `json:"droppedTargets"`
}

TargetDiscovery has all the active targets.

type TargetStatistics added in v0.1.3

type TargetStatistics struct {
	// JobName is the job name of this statistics
	JobName string
	// Total is all active targets number
	Total uint64
	// Health contains the number of every health status
	Health map[scrape.TargetHealth]uint64
}

TargetStatistics contains statistics number according to target health

Jump to

Keyboard shortcuts

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