factory

package
v0.0.0-...-9e6775c Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricScraper

type MetricScraper interface {
	// Serve serves the metrics to a 'sink', which can be a TUI or
	// logic that exports these served metrics to either a file or
	// maybe even served over an endpoint (some day).
	Serve(opts ...Option) error
	// SetSink sets the Sink that consumes the metrics produced
	// by the MetricScraper.
	SetSink(core.Sink)
}

MetricScraper scrapes metrics of some form and serves it based on the implementation.

type MetricScraperFactory

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

MetricScraperFactory constructs a MetricScaper for a command and returns it.

func NewMetricScraperFactory

func NewMetricScraperFactory() *MetricScraperFactory

NewMetricScraperFactory is a constructor for the MetricScraperFactory type. By default, this will be for the core.MainCommand command.

func (*MetricScraperFactory) Construct

func (msf *MetricScraperFactory) Construct() (MetricScraper, error)

Construct constructs the MetricScraper for a particular Command and returns it.

func (*MetricScraperFactory) ForCommand

func (msf *MetricScraperFactory) ForCommand(command core.Command) *MetricScraperFactory

ForCommand sets the command for which a MetricScraper needs to be constructed.

func (*MetricScraperFactory) ForSingularEntity

func (msf *MetricScraperFactory) ForSingularEntity(entity string) *MetricScraperFactory

ForSingularEntity sets the factory to construct an entity specific MetricScraper.

func (*MetricScraperFactory) WithScrapeInterval

func (msf *MetricScraperFactory) WithScrapeInterval(interval uint64) *MetricScraperFactory

WithScrapeInterval sets the scrape interval for the factory.

type Option

type Option func(MetricScraper)

Option is used to inject command specific configuration.

func WithAllAs

func WithAllAs(all bool) Option

WithAllAs sets the all flag value for the ContainerCommand.

func WithCPUInfoAs

func WithCPUInfoAs(cpuInfo bool) Option

WithCPUInfoAs sets the cpuinfo flag value for the RootCommand.

func WithServerAddressAs

func WithServerAddressAs(serverAddress string) Option

Jump to

Keyboard shortcuts

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