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) LastScrapeStatistics ¶ added in v0.3.0
func (c *Coordinator) LastScrapeStatistics(jobName string, withMetricsDetail bool) (map[string]*scrape.StatisticsSeriesResult, error)
LastScrapeStatistics collect targets scrape sample statistic from all shards
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"` // TotalSeries is the total series without metrics_relabel TotalSeries int64 `json:"totalSeries"` // Shards contains ID of shards that is scraping this target Shards []string `json:"shards"` }
ExtendTarget extend Prometheus v1.Target
type JobSamplesInfo ¶ added in v0.3.0
type JobSamplesInfo struct { // JobName is the name of this job JobName string `json:"jobName"` // SamplesRateTotal is the total samples rate of this job' targets SamplesRate uint64 `json:"samplesRateTotal"` // MetricsSamplesRate indicate the metrics samples rate MetricsSamplesRate map[string]uint64 `json:"metricsSamplesRate"` }
JobSamplesInfo show total sample rate in last scrape
type Option ¶ added in v0.1.5
type Option struct { // MaxHeadSeries is max series after metrics_relabels every shard can assign MaxHeadSeries int64 // MaxProcessSeries is max series before metrics_relabels every shard can assign MaxProcessSeries 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 SamplesInfo ¶ added in v0.3.0
type SamplesInfo struct { // SamplesRate is total sample rate in last scrape SamplesRate uint64 `json:"samplesRate"` // JobsSamplesRate show total sample rate in last scrape about a job JobsSamplesRate []*JobSamplesInfo `json:"jobsSamplesRate"` }
SamplesInfo contains statistic of sample scraped rate
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, getLastScrapeStatistics func(jobName string, withoutMetricsDetail bool) (map[string]*kscrape.StatisticsSeriesResult, error), 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
Click to show internal directories.
Click to hide internal directories.