prom

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

View Source
var DefaultConfig = &ConfigInfo{
	RawContent:  []byte(defaultConfig),
	ConfigHash:  "",
	Config:      &config.DefaultConfig,
	ExtraConfig: &ExtraConfig{},
}

DefaultConfig init a ConfigInfo with default prometheus config

Functions

This section is empty.

Types

type Client

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

Client is a client to do prometheus API request

func NewClient

func NewClient(url string) *Client

NewClient return an cli with url

func (*Client) ConfigReload

func (c *Client) ConfigReload() error

ConfigReload do Config reloading

func (*Client) TSDBInfo added in v0.1.4

func (c *Client) TSDBInfo() (*TSDBInfo, error)

TSDBInfo return the current head status of this shard

func (*Client) Targets

func (c *Client) Targets(state string) (*v1.TargetDiscovery, error)

Targets is compatible with prometheusURL /api/v1/targets the origin prometheusURL's Config is injected, so the targets it report must be adjusted by cli sidecar

type ConfigInfo added in v0.0.5

type ConfigInfo struct {
	// RawContent is the content of config file
	RawContent []byte
	// ConfigHash is a md5 of config file content
	ConfigHash string
	// Config is the marshaled prometheus config
	Config *config.Config
	// ExtraConfig contains Config not in origin Prometheus define
	ExtraConfig *ExtraConfig
}

ConfigInfo include all information of current config

type ConfigManager added in v0.0.5

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

ConfigManager do config manager

func NewConfigManager added in v0.0.5

func NewConfigManager() *ConfigManager

NewConfigManager return an config manager

func (*ConfigManager) AddReloadCallbacks added in v0.0.5

func (c *ConfigManager) AddReloadCallbacks(f ...func(c *ConfigInfo) error)

AddReloadCallbacks add callbacks of config reload event

func (*ConfigManager) ConfigInfo added in v0.0.5

func (c *ConfigManager) ConfigInfo() *ConfigInfo

ConfigInfo return current config info

func (*ConfigManager) ReloadFromFile added in v0.1.5

func (c *ConfigManager) ReloadFromFile(file string) error

ReloadFromFile reload config from file and do all callbacks

func (*ConfigManager) ReloadFromRaw added in v0.1.5

func (c *ConfigManager) ReloadFromRaw(data []byte) (err error)

ReloadFromRaw reload config from raw data

func (*ConfigManager) UpdateExtraConfig added in v0.3.0

func (c *ConfigManager) UpdateExtraConfig(cfg ExtraConfig) error

UpdateExtraConfig set new extra config

type ExtraConfig added in v0.3.0

type ExtraConfig struct {
	// StopScrapeReason ,if not empty, all scrape will failed
	StopScrapeReason string `json:"stopScrapeReason"`
}

ExtraConfig is config about kvass it self , not Prometheus config

func (*ExtraConfig) EQ added in v0.3.0

func (c *ExtraConfig) EQ(e *ExtraConfig) bool

EQ return true if all ExtraConfig fields is eq

type RuntimeInfo

type RuntimeInfo struct {
	// TimeSeriesCount is the series the prometheus head check handled
	TimeSeriesCount int64 `json:"timeSeriesCount"`
}

RuntimeInfo include some filed the prometheus API /api/v1/runtimeinfo returned

type TSDBInfo added in v0.1.4

type TSDBInfo struct {
	// HeadStats include information of current head block
	HeadStats struct {
		// NumSeries is current series in head block (in memory)
		NumSeries int64 `json:"numSeries"`
	} `json:"headStats"`
}

TSDBInfo include some filed the prometheus API /api/v1/status/tsdb returned

Jump to

Keyboard shortcuts

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