run

package
v0.0.0-...-3c2e606 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accumulator

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

An Accumulator maintains metadata and reservoir-sampled data for all time series within a single run.

func NewAccumulator

func NewAccumulator(reader *Reader) *Accumulator

NewAccumulator creates an Accumulator from a Reader's output channel and starts a goroutine to ingest data. The caller is still in charge of calling reader.Reload to wake up the reader.

func (*Accumulator) Last

func (acc *Accumulator) Last(tag string) *ValueDatum

Last returns the last value stored for the given time series, or nil if no data has been seen.

func (*Accumulator) List

func (acc *Accumulator) List() mem.MetadataStore

List lists all tags with their summary metadata.

func (*Accumulator) Metadata

func (acc *Accumulator) Metadata(tag string) *spb.SummaryMetadata

Metadata returns the summary metadata for the given tag, or nil if it hasn't been seen. The summary metadata may also be nil if the tag has been seen but had nil metadata, in which case it will also have no data.

func (*Accumulator) Sample

func (acc *Accumulator) Sample(tag string) []ValueDatum

Sample returns a sample of the values stored for the given time series, or an empty slice if no data has been seen. (It is not possible for a time series to be present with no data, so this is lossless.)

type Reader

type Reader struct {
	// Out is the output channel for values and errors.
	Out <-chan ValueResult
	// contains filtered or unexported fields
}

Reader reads events from all event files in a directory and streams their values after compatibility transformations. Call Reload while listening to its Out channel.

func (*Reader) Close

func (rr *Reader) Close() error

Close implements io.Closer. If there are multiple errors when closing underlying files, an arbitrary one is returned.

func (*Reader) MetadataStore

func (rr *Reader) MetadataStore() mem.MetadataStore

MetadataStore returns the mem.MetadataStore tracked by this reader, which must not be accessed concurrent with any Reload.

func (*Reader) Reload

func (rr *Reader) Reload()

Reload polls event files again and reads them to current EOF. It blocks until the reload finishes. Must not be called concurrently with any method on the reader, including another call to Reload.

type ReaderBuilder

type ReaderBuilder struct {
	// FS is the filesystem to use for read operations.
	FS fs.Filesystem
	// Dir is the directory being loaded, as a path under FS.
	Dir string

	// BufSize controls the size of the reader buffer on the underlying
	// event file. It's optional; zero means to use a default.
	BufSize int
	// ChanBuf controls the buffer size on the output channel.
	ChanBuf int
}

ReaderBuilder specifies options for a Reader.

func (ReaderBuilder) Start

func (b ReaderBuilder) Start() *Reader

Start starts a reader in a new goroutine. Once woken with a call to Reload, it reads the full contents of the run directory, then goes to sleep again.

type ValueDatum

type ValueDatum struct {
	EventStep     mem.Step
	EventWallTime float64
	Value         *spb.Summary_Value
}

A ValueDatum holds a Summary.Value protobuf with the step and wall time from the enclosing event.

func (ValueDatum) Step

func (d ValueDatum) Step() mem.Step

Step implements the StepIndexed interface.

type ValueResult

type ValueResult struct {
	Datum *ValueDatum
	Err   error
}

A ValueResult is either a non-nil Datum plus a nil Err or a nil Datum plus a non-nil Err.

Jump to

Keyboard shortcuts

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