status

package
v3.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-2-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInstanceTimeout = 5 * time.Second

DefaultInstanceTimeout bounds collection of one instance's status by default.

Variables

This section is empty.

Functions

func Status

func Status(runningCtx running.RunningCtx, printer InstanceStatusPrinter,
	instanceTimeout time.Duration,
) error

Status writes the instance statuses. instanceTimeout bounds collection of a single instance's state, including connection setup; zero disables the timeout. An external process gets the state of its process alone: it has no console to ask about the rest.

The state is the state of the watchdog, as for a Tarantool instance: an external process whose watchdog is gone while its process runs on (running.Orphan) is not running, since nothing supervises it, and gets an alert that names the process and how to stop it.

An instance that a systemd unit manages is read from the same pid file as any, that of the watchdog its unit runs, and shows its unit.

A printer that shows the details gets the tarantool every Tarantool instance starts on as well, chosen without running it.

Types

type InstanceStatusPrinter

type InstanceStatusPrinter interface {
	Print(instances map[string]*instanceStatus) error
}

InstanceStatusPrinter interface defines methods to output instance status information.

type JSONPrinter

type JSONPrinter struct{}

JSONPrinter implements InstanceStatusPrinter for JSON output.

func NewJSONPrinter

func NewJSONPrinter() *JSONPrinter

NewJSONPrinter creates a new JSONPrinter instance.

func (JSONPrinter) Print

func (j JSONPrinter) Print(instances map[string]*instanceStatus) error

Print outputs the instance status map in JSON format.

type TablePrinter

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

TablePrinter implements InstanceStatusPrinter for table output.

func NewTablePrinter

func NewTablePrinter(opts ...TablePrinterOption) *TablePrinter

NewTablePrinter creates a new TablePrinter with the given options.

func (TablePrinter) Print

func (t TablePrinter) Print(instances map[string]*instanceStatus) error

Print outputs the instance status map in table format. The UNIT column, the systemd unit that manages an instance, is there only when a unit manages some of the instances.

type TablePrinterOption

type TablePrinterOption func(*TablePrinter)

TablePrinterOption represents a configuration option for TablePrinter.

func WithDetails

func WithDetails(withDetails bool) TablePrinterOption

WithDetails controls detailed alert output.

func WithPretty

func WithPretty() TablePrinterOption

WithPretty enables pretty table formatting.

type YAMLPrinter

type YAMLPrinter struct{}

YAMLPrinter implements InstanceStatusPrinter for YAML output.

func NewYAMLPrinter

func NewYAMLPrinter() *YAMLPrinter

NewYAMLPrinter creates a new YAMLPrinter instance.

func (YAMLPrinter) Print

func (y YAMLPrinter) Print(instances map[string]*instanceStatus) error

Print outputs the instance status map in YAML format.

Jump to

Keyboard shortcuts

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