process

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: 14 Imported by: 0

Documentation

Overview

Package process runs Agent processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	Path string
	Args []string
	Env  []string
}

Params represent Agent process parameters: command path, command-line arguments/flags, and process environment.

func (*Params) String

func (p *Params) String() string

type Process

type Process struct {
	// contains filtered or unexported fields
}

Process represents Agent process started by pmm-agent.

Process object should be created with New and started with Run (typically in a separate goroutine). It then handles process starting, restarting with backoff, reading its output. Process is gracefully stopped when context passed to New is canceled. Changes of process status are reported via Changes channel which must be read until it is closed.

Process status is changed by finite state machine (see agent_status.dot). Each state logic is encapsulated in toXXX methods. Each method sends a new status to the changes channel, implements its own logic, and then switches to then next state via "go toXXX()". "go" statement is used only to avoid stack overflow; there are no extra goroutines for states.

func New

func New(params *Params, redactWords []string, l *logrus.Entry) *Process

New creates new process.

func (*Process) Changes

func (p *Process) Changes() <-chan inventorypb.AgentStatus

Changes returns channel that should be read until it is closed.

func (*Process) Logs

func (p *Process) Logs() []string

Logs returns latest process logs.

func (*Process) Run

func (p *Process) Run(ctx context.Context)

Run starts process and runs until ctx is canceled.

Jump to

Keyboard shortcuts

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