client

package
v2.15.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package client contains business logic of working with pmm-managed.

Index

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 New

func New(cfg *config.Config, supervisor supervisor, connectionChecker connectionChecker) *Client

New creates new client.

Caller should call Run.

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

func (c *Client) GetNetworkInformation() (latency, clockDrift time.Duration, err error)

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

func (c *Client) Run(ctx context.Context) error

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.

Directories

Path Synopsis
Package channel contains protocol details of two-way communication channel between pmm-managed and pmm-agent.
Package channel contains protocol details of two-way communication channel between pmm-managed and pmm-agent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL