Documentation ¶
Overview ¶
Package client contains business logic of working with pmm-managed.
Index ¶
- type Client
- func (c *Client) Collect(ch chan<- prometheus.Metric)
- func (c *Client) Describe(chan<- *prometheus.Desc)
- func (c *Client) Done() <-chan struct{}
- func (c *Client) GetNetworkInformation() (latency, clockDrift time.Duration, err error)
- func (c *Client) GetServerConnectMetadata() *agentpb.ServerConnectMetadata
- func (c *Client) Run(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents pmm-agent's connection to nginx/pmm-managed.
func (*Client) Collect ¶
func (c *Client) Collect(ch chan<- prometheus.Metric)
Collect implements "unchecked" prometheus.Collector.
func (*Client) Describe ¶
func (c *Client) Describe(chan<- *prometheus.Desc)
Describe implements "unchecked" prometheus.Collector.
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done is closed when all supervisors's requests are sent (if possible) and connection is closed.
func (*Client) GetNetworkInformation ¶
GetNetworkInformation sends ping request to the server and returns info about latency and clock drift.
func (*Client) GetServerConnectMetadata ¶
func (c *Client) GetServerConnectMetadata() *agentpb.ServerConnectMetadata
GetServerConnectMetadata returns current server's metadata, or nil.
func (*Client) Run ¶
Run connects to the server, processes requests and sends responses.
Once Run exits, connection is closed, and caller should cancel supervisor's context. Then caller should wait until Done() channel is closed. That Client instance can't be reused after that.
Returned error is already logged and should be ignored. It is returned only for unit tests.