Version: v0.0.0-...-6719cd2 Latest Latest

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0



Package kgstats fetches and caches runtime statistics about the cluster and dataset.



This section is empty.


This section is empty.


This section is empty.


type FetchStats

type FetchStats func(ctx context.Context) (planner.Stats, error)

FetchStats collects the latest statistics from the views. Upon success, it returns the statistics (must be non-nil). Otherwise, it returns a context error or some other transient error.

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields

A Fetcher periodically collects stats and caches them.

func NewFetcher

func NewFetcher(fetchStats FetchStats) *Fetcher

NewFetcher constructs a new Fetcher. The caller should subsequently call Run.

func (*Fetcher) Last

func (fetcher *Fetcher) Last(ctx context.Context) (planner.Stats, error)

Last blocks until any stats are available, then returns the latest cached stats. Upon success, it returns stats (non-nil) that are likely somewhat stale. The returned stats object is shared, so it should be treated as immutable. Otherwise, Last returns a context error.

func (*Fetcher) Run

func (fetcher *Fetcher) Run(ctx context.Context)

Run is a long-running blocking call that periodically updates the Fetcher's statistics. It exits once ctx is closed.

Source Files

Jump to

Keyboard shortcuts

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