shard

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Shards return current Shards in the cluster
	Shards() ([]*Shard, 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
	// 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"`
	// IdleAt is the time this shard become idle
	// it is nil if this shard is not idle
	// TODO: user IdleAt to support shard scaling down
	IdleAt *time.Time `json:"idleAt,omitempty"`
}

RuntimeInfo contains all running status of this shard

type Shard

type Shard struct {
	ID string
	// contains filtered or unexported fields
}

Shard is a shard instance 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) *Shard

NewGroup return a new shard with no replicate

func (*Shard) AddReplicas

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

AddReplicas add a Replicas to this shard

func (*Shard) Replicas

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

Replicas return all replicates of this shard

func (*Shard) RuntimeInfo

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

RuntimeInfo return the runtime status of this Shard

func (*Shard) TargetStatus

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

TargetStatus return the target runtime status that Shard scraping

func (*Shard) TargetsScraping

func (s *Shard) TargetsScraping() (map[uint64]bool, error)

TargetsScraping return the targets hash that this Shard scraping the key of the map is target hash the result is union set of all replicates

func (*Shard) UpdateTarget

func (s *Shard) UpdateTarget(targets map[string][]*target.Target) error

UpdateTarget update the scraping targets of this Shard every Replicas will compare the new targets to it's targets scraping cache and decide if communicate with sidecar or not, request will be send to sidecar only if new activeTargets not eq to the scraping

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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