providers

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MockDataSource         DataSourceType = "mock"
	PrometheusDataSource   DataSourceType = "prom"
	MetricServerDataSource DataSourceType = "metricserver"
	GrpcDataSource         DataSourceType = "grpc"
	DataSourceTypeKey      string         = "data-source-type"
)

Variables

View Source
var GrpcConfigKeys = []string{"grpc-ds-address", "grpc-ds-timeout"}
View Source
var PrometheusConfigKeys = []string{"prometheus-address", "prometheus-auth-username", "prometheus-auth-password",
	"prometheus-auth-bearertoken", "prometheus-query-concurrency", "prometheus-insecure-skip-verify",
	"prometheus-keepalive", "prometheus-timeout", "prometheus-bratelimit", "prometheus-maxpoints"}

Functions

This section is empty.

Types

type ClientAuth

type ClientAuth struct {
	Username    string
	BearerToken string
	Password    string
}

ClientAuth holds the HTTP client identity info.

func (*ClientAuth) Apply

func (auth *ClientAuth) Apply(req *http.Request)

Apply applies the authentication identity info to the HTTP request headers

type DataSourceType added in v0.3.0

type DataSourceType string

type GrpcConfig added in v0.6.0

type GrpcConfig struct {
	Address string
	Timeout time.Duration
}

type History added in v0.3.0

type History interface {
	// QueryTimeSeries returns the time series that meet thw given metricNamer.
	QueryTimeSeries(metricNamer metricnaming.MetricNamer, startTime time.Time, endTime time.Time, step time.Duration) ([]*common.TimeSeries, error)
}

History is a data source can provides history time series data at any time periods.

type HistoryDataProxy added in v0.3.0

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

func NewHistoryDataProxy added in v0.3.0

func NewHistoryDataProxy(historyProviders map[DataSourceType]History) *HistoryDataProxy

NewHistoryDataProxy return a proxy for all history providers, now it has no selecting policy configurable. Default policy is traversing all providers one by one until no error return.

func (*HistoryDataProxy) DeleteHistoryProvider added in v0.3.0

func (h *HistoryDataProxy) DeleteHistoryProvider(name DataSourceType)

func (*HistoryDataProxy) QueryTimeSeries added in v0.3.0

func (h *HistoryDataProxy) QueryTimeSeries(metricNamer metricnaming.MetricNamer, startTime time.Time, endTime time.Time, step time.Duration) ([]*common.TimeSeries, error)

func (*HistoryDataProxy) RegisterHistoryProvider added in v0.3.0

func (h *HistoryDataProxy) RegisterHistoryProvider(name DataSourceType, provider History)

type Interface

type Interface interface {
	RealTime
	History
}

Interface is a source of monitoring metric that provides metrics that can be used for prediction, such as 'cpu usage', 'memory footprint', 'request per second (qps)', etc.

type MockConfig

type MockConfig struct {
	SeedFile string
}

MockConfig represents the config of an in-memory provider, which is for demonstration or testing purpose.

type PromConfig

type PromConfig struct {
	Address            string
	Timeout            time.Duration
	KeepAlive          time.Duration
	InsecureSkipVerify bool
	Auth               ClientAuth

	QueryConcurrency            int
	BRateLimit                  bool
	MaxPointsLimitPerTimeSeries int
}

PromConfig represents the config of prometheus

type RealTime added in v0.3.0

type RealTime interface {
	// QueryLatestTimeSeries returns the latest metric values that meet the given metricNamer.
	QueryLatestTimeSeries(metricNamer metricnaming.MetricNamer) ([]*common.TimeSeries, error)
}

RealTime is a source of monitoring metric that provides data that is streamed data in current time.

type RealTimeDataProxy added in v0.3.0

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

func NewRealTimeDataProxy added in v0.3.0

func NewRealTimeDataProxy(realtimeProviders map[DataSourceType]RealTime) *RealTimeDataProxy

NewRealTimeDataProxy returns a proxy for all realtime providers, now it has no selecting policy configurable. Default policy is traversing all providers one by one until no error return.

func (*RealTimeDataProxy) DeleteRealTimeProvider added in v0.3.0

func (r *RealTimeDataProxy) DeleteRealTimeProvider(name DataSourceType)

func (*RealTimeDataProxy) QueryLatestTimeSeries added in v0.3.0

func (r *RealTimeDataProxy) QueryLatestTimeSeries(metricNamer metricnaming.MetricNamer) ([]*common.TimeSeries, error)

func (*RealTimeDataProxy) RegisterRealTimeProvider added in v0.3.0

func (r *RealTimeDataProxy) RegisterRealTimeProvider(name DataSourceType, provider RealTime)

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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