Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDataFetcher ¶
func NewDataFetcher(options ...Option) (datafetcher.Interface, error)
NewDataFetcher constructs a DataFetcher instance by applying all the provided options. Returns error if any one of the options fails.
Types ¶
type DataFetcher ¶
type DataFetcher struct {
// contains filtered or unexported fields
}
DataFetcher implements datafetcher.Interface and is used to fetch time series data from the given prometheus endpoint.
func (*DataFetcher) Fetch ¶
func (f *DataFetcher) Fetch() (result model.Value, err error)
Fetch the data from prometheus, filter it using the provided labels, matching operations and corresponding values and return the result. Time series is fetched using the v1 API. Note that v1 API is still in experimental stage and therefore we need to watch out for compatibility issues.
func (*DataFetcher) GetEndpoint ¶
func (f *DataFetcher) GetEndpoint() string
GetEndpoint returns the prometheus HTTP server endpoint.
func (*DataFetcher) SetStrategy ¶
func (f *DataFetcher) SetStrategy(s strategies.Interface)
SetStrategy sets the task ranking strategy and instantiates the query builder.
type Option ¶
type Option func(f *DataFetcher) error
func WithPrometheusEndpoint ¶
WithPrometheusEndpoint returns an option that initializes the prometheus HTTP server endpoint.