Documentation ¶
Overview ¶
Package supervisord provides facilities for working with Supervisord.
Index ¶
- type Logs
- type PMMUpdateChecker
- type Service
- func (s *Service) ForceCheckUpdates() error
- func (s *Service) InstalledPMMVersion() *version.PackageInfo
- func (s *Service) LastCheckUpdatesResult() (*version.UpdateCheckResult, time.Time)
- func (s *Service) Run(ctx context.Context)
- func (s *Service) StartUpdate() (uint32, error)
- func (s *Service) UpdateConfiguration(settings *models.Settings) error
- func (s *Service) UpdateLog(offset uint32) ([]string, uint32, error)
- func (s *Service) UpdateRunning() bool
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.
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() *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) *Service
New creates new service.
func (*Service) ForceCheckUpdates ¶
ForceCheckUpdates forces check for PMM updates. Result can be obtained via LastCheckUpdatesResult.
func (*Service) InstalledPMMVersion ¶
func (s *Service) InstalledPMMVersion() *version.PackageInfo
InstalledPMMVersion returns currently installed PMM version information.
func (*Service) LastCheckUpdatesResult ¶
func (s *Service) LastCheckUpdatesResult() (*version.UpdateCheckResult, time.Time)
LastCheckUpdatesResult returns last PMM update check result and last check time.
func (*Service) StartUpdate ¶
StartUpdate starts pmm-update-perform supervisord program with some preparations. It returns initial log file offset.
func (*Service) UpdateConfiguration ¶
UpdateConfiguration updates Prometheus, Alertmanager, and qan-api2 configurations, restarting them if needed.
func (*Service) UpdateLog ¶
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 ¶
UpdateRunning returns true if dashboard-upgrade or pmm-update-perform is not done yet.