shard

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group added in v0.0.2

type Group struct {
	// ID is the unique ID of this group
	ID string
	// contains filtered or unexported fields
}

Group is a shard group contains one or more replicates it knows how to communicate with shard sidecar and manager local scraping cache

func NewGroup

func NewGroup(id string, lg logrus.FieldLogger) *Group

NewGroup return a new shard with no replicate

func (*Group) AddReplicas added in v0.0.2

func (s *Group) AddReplicas(r *Replicas)

AddReplicas add a Replicas to this shard

func (*Group) Replicas added in v0.0.2

func (s *Group) Replicas() []*Replicas

Replicas return all replicates of this shard

func (*Group) RuntimeInfo added in v0.0.2

func (s *Group) RuntimeInfo() (*RuntimeInfo, error)

RuntimeInfo return the runtime status of this Group

func (*Group) TargetStatus added in v0.0.2

func (s *Group) TargetStatus() (map[uint64]*target.ScrapeStatus, error)

TargetStatus return the target runtime status that Group scraping cached result will be send if something wrong

func (*Group) UpdateTarget added in v0.0.2

func (s *Group) UpdateTarget(request *UpdateTargetsRequest) error

UpdateTarget update the scraping targets of this Group every Replicas will compare the new targets to it's targets scraping cache and decide if communicate with sidecar or not,

type Manager

type Manager interface {
	// Shards return current Shards in the cluster
	Shards() ([]*Group, error)
	// ChangeScale create or delete Shards according to "expReplicate"
	ChangeScale(expReplicate int32) error
}

Manager known how to create or delete Shards

type Replicas

type Replicas struct {
	// ID is the unique ID for differentiate different replicate of shard
	ID string
	// APIGet is a function to do stand api request to target
	// exposed this field for user to writ unit testing easily
	APIGet func(url string, ret interface{}) error
	// APIPost is a function to do stand api request to target
	// exposed this field for user to writ unit testing easily
	APIPost func(url string, req interface{}, ret interface{}) (err error)
	// contains filtered or unexported fields
}

Replicas is a replicas of one shard all replicas of one shard scrape same targets and expected to have same load

func NewReplicas

func NewReplicas(id string, url string, log logrus.FieldLogger) *Replicas

NewReplicas create a Replicas with empty scraping cache

type RuntimeInfo

type RuntimeInfo struct {
	// HeadSeries return current head_series of prometheus
	HeadSeries int64 `json:"headSeries"`
	// ConfigMD5 is the md5 of current config file
	ConfigMD5 string `json:"ConfigMD5"`
	// IdleStartAt is the time that shard begin idle
	IdleStartAt *time.Time
}

RuntimeInfo contains all running status of this shard

type UpdateTargetsRequest added in v0.0.3

type UpdateTargetsRequest struct {
	// targets contains all targets this shard should scrape
	Targets map[string][]*target.Target
}

UpdateTargetsRequest contains all information about the targets updating request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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