Documentation ¶
Index ¶
- Constants
- func DoRequestWithPossibleRetry(hc *fasthttp.HostClient, req *fasthttp.Request, resp *fasthttp.Response, ...) error
- func GetHTTPClient() *http.Client
- func JoinHostPort(host string, port int) string
- func SanitizeLabelName(name string) string
- func TestEqualLabelss(t *testing.T, got, want []*promutils.Labels)
- type Client
- func (c *Client) APIServer() string
- func (c *Client) Addr() string
- func (c *Client) GetAPIResponse(path string) ([]byte, error)
- func (c *Client) GetAPIResponseWithReqParams(path string, modifyRequestParams func(request *fasthttp.Request)) ([]byte, error)
- func (c *Client) GetBlockingAPIResponse(path string, inspectResponse func(resp *fasthttp.Response)) ([]byte, error)
- type ConfigMap
Constants ¶
const BlockingClientReadTimeout = 10 * time.Minute
BlockingClientReadTimeout is the maximum duration for waiting the response from GetBlockingAPI*
Variables ¶
This section is empty.
Functions ¶
func DoRequestWithPossibleRetry ¶
func DoRequestWithPossibleRetry(hc *fasthttp.HostClient, req *fasthttp.Request, resp *fasthttp.Response, deadline time.Time, requestCounter, retryCounter *metrics.Counter) error
DoRequestWithPossibleRetry performs the given req at hc and stores the response at resp.
func GetHTTPClient ¶
GetHTTPClient returns default client for http API requests.
func SanitizeLabelName ¶
SanitizeLabelName replaces anything that doesn't match client_label.LabelNameRE with an underscore.
This has been copied from Prometheus sources at util/strutil/strconv.go
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is http client, which talks to the given apiServer.
func NewClient ¶
func NewClient(apiServer string, ac *promauth.Config, proxyURL *proxy.URL, proxyAC *promauth.Config) (*Client, error)
NewClient returns new Client for the given args.
func (*Client) GetAPIResponse ¶
GetAPIResponse returns response for the given absolute path.
func (*Client) GetAPIResponseWithReqParams ¶
func (c *Client) GetAPIResponseWithReqParams(path string, modifyRequestParams func(request *fasthttp.Request)) ([]byte, error)
GetAPIResponseWithReqParams returns response for given absolute path with optional callback for request. modifyRequestParams should never reference data from request.
func (*Client) GetBlockingAPIResponse ¶
func (c *Client) GetBlockingAPIResponse(path string, inspectResponse func(resp *fasthttp.Response)) ([]byte, error)
GetBlockingAPIResponse returns response for given absolute path with blocking client and optional callback for api response, inspectResponse - should never reference data from response.
type ConfigMap ¶
type ConfigMap struct {
// contains filtered or unexported fields
}
ConfigMap is a map for storing discovery api configs.
It automatically removes old configs which weren't accessed recently.