scraper

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinSampleCount is the minimum number of samples needed by the detection algorithm to start estimating anomalies.
	MinSampleCount = 1 << 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Scraper

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

Scraper holds the configuration for a scraper.

func New

func New(options *madoptions.Options) (*Scraper, error)

New returns a new Scraper.

func (*Scraper) LenSamples

func (s *Scraper) LenSamples() uint8

LenSamples is a wrapper over sampleChan.Len.

func (*Scraper) ReadSample

func (s *Scraper) ReadSample() TimestampedFloat64

ReadSample is a wrapper over sampleChan.Read.

func (*Scraper) Scrape

func (s *Scraper) Scrape(ctx context.Context, stop chan os.Signal) error

Scrape scrapes the endpoint and sends the metric value to the sample channel.

func (*Scraper) String

func (s *Scraper) String() string

String returns a pretty-printed string representation of the Scraper.

func (*Scraper) WriteSample

func (s *Scraper) WriteSample(sample float64)

WriteSample is a wrapper over sampleChan.Write.

type TimestampedFloat64

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

TimestampedFloat64 holds a timestamped float64 value.

func (*TimestampedFloat64) String

func (tsf *TimestampedFloat64) String() string

String returns a pretty-printed string representation of the TimestampedFloat64.

func (*TimestampedFloat64) Timestamp

func (tsf *TimestampedFloat64) Timestamp() time.Time

Timestamp returns the timestamp of the sample.

func (*TimestampedFloat64) Value

func (tsf *TimestampedFloat64) Value() float64

Value returns the value of the sample.

Jump to

Keyboard shortcuts

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