subprocessmanager

package
v0.0.0-...-e63745f Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HealthyProcessTime is the default time a process needs to stay alive to be considered healthy
	HealthyProcessTime time.Duration = 30 * time.Minute
	// HealthyCrashCount is the amount of times a process can crash (within the healthyProcessTime) before being considered unstable - it may be trying to find a port
	HealthyCrashCount int = 3
)

Variables

This section is empty.

Functions

func GetDelay

func GetDelay(elapsed time.Duration, crashCount int) time.Duration

GetDelay will compute the delay for a given process according to its crash count and time alive using an exponential backoff algorithm

Types

type EnvConfig

type EnvConfig struct {
	// Name is the name of the environment variable
	Name string `mapstructure:"name"`
	// Value is the value of the variable
	Value string `mapstructure:"value"`
}

EnvConfig is the config definition of each key-value pair for environment variables

type Process

type Process struct {
	Command string
	Port    int
	Env     []EnvConfig
}

Process struct holds all the info needed to instantiate a subprocess

func (*Process) Run

func (proc *Process) Run(logger *zap.Logger) (time.Duration, error)

Run will start the process and keep track of running time

type SubprocessConfig

type SubprocessConfig struct {
	// Command is the command to be run (binary + flags, separated by commas)
	Command string `mapstructure:"exec"`
	// Port is the port assigned to the Receiver, and to the {{port}} template variables
	Port int `mapstructure:"port"`
	// Env is a list of env variables to pass to a specific command
	Env []EnvConfig `mapstructure:"env"`
}

SubprocessConfig is the config definition for the subprocess manager

Jump to

Keyboard shortcuts

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