sidecar

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InjectConfigOptions

type InjectConfigOptions struct {
	// ProxyURL will be injected to all job if it is not empty
	ProxyURL string
	// PrometheusURL will be injected
	PrometheusURL string
	// ShardMonitorEnable is true, a self monitor will be injected
	ShardMonitorEnable bool
}

InjectConfigOptions indicate what to inject to config file

type Injector

type Injector struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Injector gen injected config file

func NewInjector

func NewInjector(outFile string, option InjectConfigOptions,
	promRegistry prometheus.Registerer,
	log logrus.FieldLogger) *Injector

NewInjector create new injector with InjectConfigOptions

func (*Injector) ApplyConfig added in v0.0.5

func (i *Injector) ApplyConfig(cfg *prom.ConfigInfo) error

ApplyConfig gen new config

func (*Injector) UpdateTargets

func (i *Injector) UpdateTargets(ts map[string][]*target.Target) error

UpdateTargets set new targets

type Proxy

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

Proxy is a Proxy server for prometheus tManager Proxy will return an empty metrics if this target if not allowed to scrape for this prometheus client otherwise, Proxy do real tManager, statistic metrics samples and return metrics to prometheus

func NewProxy

func NewProxy(
	getJob func(jobName string) *scrape.JobInfo,
	getStatus func() map[uint64]*target.ScrapeStatus,
	getCurCfg func() *prom.ConfigInfo,
	promRegistry prometheus.Registerer,
	log logrus.FieldLogger) *Proxy

NewProxy create a new proxy server

func (*Proxy) Run

func (p *Proxy) Run(address string) error

Run start Proxy server and block

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handle one Proxy request

type Service added in v0.0.3

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

Service is the api server of shard

func NewService added in v0.0.3

func NewService(
	configFile string,
	promURL string,
	getHeadSeries func() (int64, error),
	cfgManager *prom.ConfigManager,
	targetManager *TargetsManager,
	promeRegistry *prometheus.Registry,
	lg logrus.FieldLogger) *Service

NewService create new api server of shard

func (*Service) Run added in v0.0.3

func (s *Service) Run(address string) error

Run start Service at "address"

func (*Service) ServeHTTP added in v0.0.3

func (s *Service) ServeHTTP(wt http.ResponseWriter, r *http.Request)

type TargetsInfo added in v0.0.5

type TargetsInfo struct {
	// Targets is all targets this shard scraping
	Targets map[string][]*target.Target
	// IdleAt is the time this shard has no scraping targets
	// IdleAt is nil if at lease one target is scraping
	IdleAt *time.Time
	// Status is the runtime status of all targets
	Status map[uint64]*target.ScrapeStatus `json:"-"`
}

TargetsInfo contains all current targets

type TargetsManager added in v0.0.5

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

TargetsManager manager local targets of this shard

func NewTargetsManager added in v0.0.5

func NewTargetsManager(storeDir string, promRegistry prometheus.Registerer, log logrus.FieldLogger) *TargetsManager

NewTargetsManager return a new target manager

func (*TargetsManager) AddUpdateCallbacks added in v0.0.5

func (t *TargetsManager) AddUpdateCallbacks(f ...func(targets map[string][]*target.Target) error)

AddUpdateCallbacks add a call back for targets updating event

func (*TargetsManager) Load added in v0.0.5

func (t *TargetsManager) Load() error

Load load local targets information from storeDir

func (*TargetsManager) TargetsInfo added in v0.0.5

func (t *TargetsManager) TargetsInfo() TargetsInfo

TargetsInfo return current targets of this shard

func (*TargetsManager) UpdateTargets added in v0.0.5

func (t *TargetsManager) UpdateTargets(req *shard.UpdateTargetsRequest) (err error)

UpdateTargets update local targets

Jump to

Keyboard shortcuts

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