prom

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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
}

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

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