Documentation
¶
Overview ¶
Package handler provides a client and handlers for responding to locate requests.
Index ¶
- type Client
- func (c *Client) Heartbeat(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Live(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Monitoring(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Nearest(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Prometheus(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Ready(rw http.ResponseWriter, req *http.Request)
- func (c *Client) Registrations(rw http.ResponseWriter, req *http.Request)
- func (c *Client) UpdatePrometheusForMachine(ctx context.Context, hostname string) error
- type ClientLocator
- type Limiter
- type LocatorV2
- type PrometheusClient
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Signer
LocatorV2
ClientLocator
PrometheusClient
// contains filtered or unexported fields
}
Client contains state needed for xyz.
func NewClient ¶
func NewClient(project string, private Signer, locatorV2 LocatorV2, client ClientLocator, prom PrometheusClient, lmts limits.Agents, limiter Limiter, earlyExitClients []string) *Client
NewClient creates a new client.
func NewClientDirect ¶ added in v0.4.1
func NewClientDirect(project string, private Signer, locatorV2 LocatorV2, client ClientLocator, prom PrometheusClient) *Client
NewClientDirect creates a new client with a target template using only the target machine.
func (*Client) Heartbeat ¶
func (c *Client) Heartbeat(rw http.ResponseWriter, req *http.Request)
Heartbeat implements /v2/heartbeat requests. It starts a new persistent connection and a new goroutine to read incoming messages.
func (*Client) Live ¶ added in v0.14.10
func (c *Client) Live(rw http.ResponseWriter, req *http.Request)
Live is a minimal handler to indicate that the server is operating at all.
func (*Client) Monitoring ¶
func (c *Client) Monitoring(rw http.ResponseWriter, req *http.Request)
Monitoring issues access tokens for end to end monitoring requests.
func (*Client) Nearest ¶ added in v0.11.0
func (c *Client) Nearest(rw http.ResponseWriter, req *http.Request)
Nearest uses an implementation of the LocatorV2 interface to look up nearest servers.
func (*Client) Prometheus ¶ added in v0.13.0
func (c *Client) Prometheus(rw http.ResponseWriter, req *http.Request)
Prometheus is a handler that collects Prometheus health signals.
func (*Client) Ready ¶ added in v0.14.10
func (c *Client) Ready(rw http.ResponseWriter, req *http.Request)
Ready reports whether the server is working as expected and ready to serve requests.
func (*Client) Registrations ¶ added in v0.16.0
func (c *Client) Registrations(rw http.ResponseWriter, req *http.Request)
Registrations returns information about registered machines. There are 3 supported query parameters:
* format - defines the format of the returned JSON * org - limits results to only records for the given organization * exp - limits results to only records for the given experiment (e.g., ndt)
The "org" and "exp" query parameters are currently only supported by the default or "machines" format.
type ClientLocator ¶ added in v0.7.0
ClientLocator defines the interfeace for looking up the client geo location.
type Limiter ¶ added in v0.17.1
type Limiter interface {
IsLimited(ip, ua string) (limits.LimitStatus, error)
}
type LocatorV2 ¶ added in v0.11.0
type LocatorV2 interface {
Nearest(service string, lat, lon float64, opts *heartbeat.NearestOptions) (*heartbeat.TargetInfo, error)
heartbeat.StatusTracker
}
LocatorV2 defines how the Nearest handler requests machines nearest to the client.