app/vmctl: remove ping from remote read protocol (#4749)

Ping method was never used, so we remove it.
This commit is contained in:
Dmytro Kozlov 2023-07-31 16:53:32 +02:00 committed by Aliaksandr Valialkin
parent 02dba5f728
commit 2d507a8757
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -23,7 +23,6 @@ import (
const ( const (
defaultReadTimeout = 5 * time.Minute defaultReadTimeout = 5 * time.Minute
remoteReadPath = "/api/v1/read" remoteReadPath = "/api/v1/read"
healthPath = "/-/healthy"
) )
// StreamCallback is a callback function for processing time series // StreamCallback is a callback function for processing time series
@ -154,23 +153,6 @@ func (c *Client) do(req *http.Request) (*http.Response, error) {
return c.c.Do(req) return c.c.Do(req)
} }
// Ping checks the health of the read source
func (c *Client) Ping() error {
url := c.addr + healthPath
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return fmt.Errorf("cannot create request to %q: %s", url, err)
}
resp, err := c.do(req)
if err != nil {
return err
}
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("bad status code: %d", resp.StatusCode)
}
return nil
}
func (c *Client) fetch(ctx context.Context, data []byte, streamCb StreamCallback) error { func (c *Client) fetch(ctx context.Context, data []byte, streamCb StreamCallback) error {
r := bytes.NewReader(data) r := bytes.NewReader(data)
url := c.addr + remoteReadPath url := c.addr + remoteReadPath