coordinator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// gin.Engine is the gin engine for handle http request
	*gin.Engine
	ConfigReload chan *config.Config
	// contains filtered or unexported fields
}

API is the api server of coordinator

func NewAPI

func NewAPI(
	readConfig func() ([]byte, error),
	getScrapeStatus func(map[string][]*discovery.SDTargets) (map[uint64]*target.ScrapeStatus, error),
	getActiveTargets func() map[string][]*discovery.SDTargets,
	getDropTargets func() map[string][]*discovery.SDTargets,
	lg logrus.FieldLogger) *API

NewAPI return a new web server

type Coordinator

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

Coordinator periodically re balance all replicates

func NewCoordinator

func NewCoordinator(
	shardManager shard.Manager,
	maxSeries int64,
	maxShard int32,
	period time.Duration,
	getExploreResult func(job string, hash uint64) *target.ScrapeStatus,
	getActive func() map[string][]*discovery.SDTargets,
	log logrus.FieldLogger) *Coordinator

NewCoordinator create a new coordinator service

func (*Coordinator) Run

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

Run do coordinate periodically until ctx done

func (*Coordinator) RunOnce

func (c *Coordinator) RunOnce() error

RunOnce get shards information from shard manager, do shard reBalance and change expect shard number

Jump to

Keyboard shortcuts

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