shard

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 9 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 ReplicasManager added in v0.1.0

type ReplicasManager interface {
	// Replicas return all replicas
	Replicas() ([]Manager, error)
}

ReplicasManager known all shard managers

type RuntimeInfo

type RuntimeInfo struct {
	// HeadSeries return current head_series of prometheus
	HeadSeries int64 `json:"headSeries"`
	// ProcessSeries is the all process series of shard
	ProcessSeries int64 `json:"processSeries"`
	// ConfigHash is the md5 of current config file
	ConfigHash string `json:"ConfigHash"`
	// IdleStartAt is the time that shard begin idle
	IdleStartAt *time.Time `json:"IdleStartAt,omitempty"`
}

RuntimeInfo contains all running status of this shard

type Shard

type Shard 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)

	// Ready indicate this shard is ready
	Ready bool
	// contains filtered or unexported fields
}

Shard is a prometheus shard

func NewShard added in v0.1.0

func NewShard(id string, url string, ready bool, log logrus.FieldLogger) *Shard

NewShard create a Shard with empty scraping cache

func (*Shard) RuntimeInfo

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

RuntimeInfo return the runtime status of this shard

func (*Shard) Samples added in v0.3.0

func (r *Shard) Samples(jobName string, withMetricsDetail bool) (map[string]*scrape.StatisticsSeriesResult, error)

Samples return the sample statistics of last scrape

func (*Shard) TargetStatus

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

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

func (*Shard) UpdateConfig added in v0.1.5

func (r *Shard) UpdateConfig(req *UpdateConfigRequest) error

UpdateConfig try update shard config by API

func (*Shard) UpdateExtraConfig added in v0.3.0

func (r *Shard) UpdateExtraConfig(req *prom.ExtraConfig) error

UpdateExtraConfig try update shard extra config by API

func (*Shard) UpdateTarget

func (r *Shard) UpdateTarget(request *UpdateTargetsRequest) error

UpdateTarget try apply targets to sidecar request will be skipped if nothing changed according to r.scraping

type UpdateConfigRequest added in v0.1.5

type UpdateConfigRequest struct {
	RawContent string `json:"rawContent"`
}

UpdateConfigRequest is request struct for POST /

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