Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTooManyRequests - Trying to send too many fetch requests ErrTooManyRequests = errors.New("Trying to send too many fetch requests") // ErrExtractingValue - Failed to extract a value with given arguments ErrExtractingValue = errors.New("Failed to extract value with given arguments") )
Functions ¶
This section is empty.
Types ¶
type BasicHTTPRequestHandler ¶
BasicHTTPRequestHandler is an HTTPRequestHandler that uses an http.Client.
type HTTPRequestHandler ¶
HTTPRequestHandler is an interface to issue Get requests.
type JSONValueFetcher ¶
type JSONValueFetcher struct {
// contains filtered or unexported fields
}
JSONValueFetcher extracts a particular field value from a JSON obtained through a GET request
func (*JSONValueFetcher) FetchInt64 ¶
func (f *JSONValueFetcher) FetchInt64(args map[string]string) (int64, error)
FetchInt64 constructs a GET HTTP query with the provided map as URL arguments and returns the value as an int64 if possible
type JSONValueFetcherConfig ¶
type JSONValueFetcherConfig struct { URL string // URL to send the GET request JQ string // JQ expression to extract a particular field from the fetched JSON TimeoutMS int // Timeout in ms for GET requests RatePerSecond int // Amount of requests allowed per second BurstSize int // Maximum amount of concurrent requests possible }
JSONValueFetcherConfig contains the required information to instantiate a JSONValueFetcher
type ValueFetcher ¶
ValueFetcher fetches values with a given set of arguments.
func NewJSONValueFetcher ¶
func NewJSONValueFetcher( config JSONValueFetcherConfig, stats reporter.StatsLogger, ) (ValueFetcher, error)
NewJSONValueFetcher returns a ValueFetcher that uses a BasicHTTPRequestHandler wrapping a http.Client instance with the given timeout in ms to service GET requests