data

package
v0.0.0-...-c386f10 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	ID        string
	Name      string
	IsCounter bool
	IsMarker  bool
}

Field describe a field in a graph.

type Getter

type Getter interface {
	io.Closer
	Get() (*gojq.JQ, error)
}

Getter is the interface used by Points to get next points.

type Points

type Points struct {
	// Size is the number of data point to store per metric.
	Size   int
	Source Getter
	// contains filtered or unexported fields
}

Points is a series of Size data points gathered from Source.

func FromHTTP

func FromHTTP(url string, interval time.Duration, size int) *Points

FromHTTP fetch data points from url every interval and keep size points.

func FromStdin

func FromStdin(size int) *Points

FromStdin reads data from stdin as one JSON object per line.

func (*Points) Close

func (p *Points) Close() error

Close calls Close on Source.

func (*Points) Get

func (p *Points) Get(name string) []float64

Get gets the points vector for name.

func (*Points) Run

func (p *Points) Run(specs []Spec) error

Run get data from the source and capture metrics following specs.

type Spec

type Spec struct {
	Fields []Field
}

Spec specify a list of field for a single graph.

func ParseSpec

func ParseSpec(args []string) ([]Spec, error)

ParseSpec parses a graph specification. Each spec is a string with one or more JSON path separated by + with fields options prefixed with colon and separated by commas.

Jump to

Keyboard shortcuts

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