supervisord

package
v2.17.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package supervisord provides facilities for working with Supervisord.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logs

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

Logs is responsible for interactions with logs.

func NewLogs

func NewLogs(pmmVersion string, pmmUpdateChecker *PMMUpdateChecker) *Logs

NewLogs creates a new Logs service. n is a number of last lines of log to read.

func (*Logs) Zip

func (l *Logs) Zip(ctx context.Context, w io.Writer) error

Zip creates .zip archive with all logs.

type PMMUpdateChecker

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

PMMUpdateChecker wraps `pmm-update -installed` and `pmm-update -check` with caching.

We almost could use `supervisorctl start pmm-update-check` and then get output from stdout log file, but that is too painful, and, unlike with `pmm-update -perform`, we don't have to do it.

func NewPMMUpdateChecker

func NewPMMUpdateChecker(l *logrus.Entry) *PMMUpdateChecker

NewPMMUpdateChecker returns a PMMUpdateChecker instance that can be shared across different parts of the code. Since this is used inside this package, it could be a singleton, but it would make things mode difficult to test.

func (*PMMUpdateChecker) Installed

func (p *PMMUpdateChecker) Installed(ctx context.Context) *version.PackageInfo

Installed returns currently installed version information. It is always cached since pmm-update RPM package is always updated before pmm-managed update/restart.

type Service

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

Service is responsible for interactions with Supervisord via supervisorctl.

func New

func New(configDir string, pmmUpdateCheck *PMMUpdateChecker, vmParams *models.VictoriaMetricsParams) *Service

New creates new service.

func (*Service) ForceCheckUpdates

func (s *Service) ForceCheckUpdates(ctx context.Context) error

ForceCheckUpdates forces check for PMM updates. Result can be obtained via LastCheckUpdatesResult.

func (*Service) InstalledPMMVersion

func (s *Service) InstalledPMMVersion(ctx context.Context) *version.PackageInfo

InstalledPMMVersion returns currently installed PMM version information.

func (*Service) LastCheckUpdatesResult

func (s *Service) LastCheckUpdatesResult(ctx context.Context) (*version.UpdateCheckResult, time.Time)

LastCheckUpdatesResult returns last PMM update check result and last check time.

func (*Service) Run

func (s *Service) Run(ctx context.Context)

Run reads supervisord's log (maintail) and sends events to subscribers.

func (*Service) StartUpdate

func (s *Service) StartUpdate() (uint32, error)

StartUpdate starts pmm-update-perform supervisord program with some preparations. It returns initial log file offset.

func (*Service) UpdateConfiguration

func (s *Service) UpdateConfiguration(settings *models.Settings) error

UpdateConfiguration updates Prometheus, Alertmanager, and qan-api2 configurations, restarting them if needed.

func (*Service) UpdateLog

func (s *Service) UpdateLog(offset uint32) ([]string, uint32, error)

UpdateLog returns some lines and a new offset from pmm-update-perform log starting from the given offset. It may return zero lines and the same offset. Caller is expected to handle this.

func (*Service) UpdateRunning

func (s *Service) UpdateRunning() bool

UpdateRunning returns true if dashboard-upgrade or pmm-update-perform is not done yet.

Jump to

Keyboard shortcuts

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