Documentation ¶
Overview ¶
Package channel contains protocol details of two-way communication channel between pmm-managed and pmm-agent.
Index ¶
- type AgentResponse
- type Channel
- func (c *Channel) Collect(ch chan<- prometheus.Metric)
- func (c *Channel) Describe(ch chan<- *prometheus.Desc)
- func (c *Channel) Requests() <-chan *ServerRequest
- func (c *Channel) SendRequest(payload agentpb.AgentRequestPayload) agentpb.ServerResponsePayload
- func (c *Channel) SendResponse(resp *AgentResponse)
- func (c *Channel) Wait() error
- type ServerRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentResponse ¶
type AgentResponse struct { ID uint32 Payload agentpb.AgentResponsePayload }
AgentResponse represents agent's response. It is similar to agentpb.AgentMessage except it can contain only responses, and the payload is already unwrapped (XXX instead of AgentMessage_XXX).
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel encapsulates two-way communication channel between pmm-managed and pmm-agent.
All exported methods are thread-safe.
func New ¶
func New(stream agentpb.Agent_ConnectClient) *Channel
New creates new two-way communication channel with given stream.
Stream should not be used by the caller after channel is created.
func (*Channel) Collect ¶
func (c *Channel) Collect(ch chan<- prometheus.Metric)
Collect implement prometheus.Collector.
func (*Channel) Describe ¶
func (c *Channel) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
func (*Channel) Requests ¶
func (c *Channel) Requests() <-chan *ServerRequest
Requests returns a channel for incoming requests. It must be read. It is closed on any error (see Wait).
func (*Channel) SendRequest ¶
func (c *Channel) SendRequest(payload agentpb.AgentRequestPayload) agentpb.ServerResponsePayload
SendRequest sends request to pmm-managed, blocks until response is available, and returns it. Response will be nil if channel is closed. It is no-op once channel is closed (see Wait).
func (*Channel) SendResponse ¶
func (c *Channel) SendResponse(resp *AgentResponse)
SendResponse sends message to pmm-managed. It is no-op once channel is closed (see Wait).
type ServerRequest ¶
type ServerRequest struct { ID uint32 Payload agentpb.ServerRequestPayload }
ServerRequest represents an request from server. It is similar to agentpb.ServerMessage except it can contain only requests, and the payload is already unwrapped (XXX instead of ServerMessage_XXX).