opts

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defaults = func(o *Options) error {
	o.MetricsURL = "http://127.0.0.1:8888/metrics"
	o.Start = time.Now()
	o.Writer = os.Stderr
	o.RefreshPeriod = time.Second * 5
	return nil
}

Defaults are the default UI options. This option will be automatically prepended to any options you pass to the NewUI constructor.

Functions

This section is empty.

Types

type Option

type Option func(*Options) error

Option is the UI option type.

func MetricsURL

func MetricsURL(url string) Option

MetricsURL configures the URL the Prometheus /metrics endpoint is at Defaults to http://127.0.0.1:8888/metrics.

func RefreshPeriod

func RefreshPeriod(rp time.Duration) Option

RefreshPeriod configures the period beiween UI refeshes. Defaults to 5s.

func Start

func Start(t time.Time) Option

Start configures the start time for the UI to calculate the uptime vaue from. Defaults to an time.Now().

func Writer

func Writer(w io.Writer) Option

Writer configures where the output should be written to. The default value is os.Stderr.

type Options

type Options struct {
	MetricsURL    string
	Start         time.Time
	Writer        io.Writer
	RefreshPeriod time.Duration
}

Options are the UI options

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

Apply applies the given options to this Option.

Jump to

Keyboard shortcuts

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