datasource

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 ClientProfile

type ClientProfile struct {
	Debug                 bool
	DefaultLimit          int64
	DefaultLanguage       string
	DefaultTimeoutSeconds int
	Region                string
	DomainSuffix          string
	Scheme                string
}

type Credentials

type Credentials struct {
	ClusterId string
	AppId     string
	SecretId  string
	SecretKey string
}

Credentials use user defined SecretId and SecretKey

type DataSourceType

type DataSourceType string
const (
	MockDataSource          DataSourceType = "mock"
	PrometheusDataSource    DataSourceType = "prom"
	MetricServerDataSource  DataSourceType = "metricserver"
	QCloudMonitorDataSource DataSourceType = "qcloudmonitor"
)

type History

type History interface {
	// QueryTimeSeries returns the time series that meet thw given metricNamer.
	QueryTimeSeries(ctx context.Context, 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

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

func NewHistoryDataProxy

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

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

func (*HistoryDataProxy) DeleteHistoryProvider

func (h *HistoryDataProxy) DeleteHistoryProvider(name DataSourceType)

func (*HistoryDataProxy) QueryTimeSeries

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

func (*HistoryDataProxy) RegisterHistoryProvider

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 LabelConverter

type LabelConverter interface {
	LabelConverter(label string) string
}

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
	FederatedClusterScope       bool
	// for thanos query, it must when use thanos as query source https://thanos.io/tip/components/query.md/#partial-response
	ThanosPartial bool
	ThanosDedup   bool
}

PromConfig represents the config of prometheus

type QCloudMonitorConfig

type QCloudMonitorConfig struct {
	Credentials   `name:"credentials" value:"optional"`
	ClientProfile `name:"clientProfile" value:"optional"`
}

type RealTime

type RealTime interface {
	// QueryLatestTimeSeries returns the latest metric values that meet the given metricNamer.
	QueryLatestTimeSeries(ctx context.Context, 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

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

func NewRealTimeDataProxy

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

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

func (*RealTimeDataProxy) DeleteRealTimeProvider

func (r *RealTimeDataProxy) DeleteRealTimeProvider(name DataSourceType)

func (*RealTimeDataProxy) QueryLatestTimeSeries

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

func (*RealTimeDataProxy) RegisterRealTimeProvider

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

Jump to

Keyboard shortcuts

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