stats

package
v0.15.8 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLookback = time.Second * 5

DefaultLookback is the default lookback used for query stats tracking.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryStats

type QueryStats interface {
	Update(newDocs int) error
	Start()
	Stop()
}

QueryStats provides an interface for updating query stats.

func NewQueryStats

func NewQueryStats(tracker QueryStatsTracker) QueryStats

NewQueryStats enables query stats to be tracked within a recency lookback duration.

func NoOpQueryStats

func NoOpQueryStats() QueryStats

NoOpQueryStats returns inactive query stats.

type QueryStatsOptions added in v0.15.3

type QueryStatsOptions struct {
	// MaxDocs limits how many recently queried max
	// documents are allowed before queries are abandoned.
	MaxDocs int64
	// Lookback specifies the lookback period over which stats are aggregated.
	Lookback time.Duration
}

QueryStatsOptions holds options for how a tracker should handle query stats.

func (QueryStatsOptions) Validate added in v0.15.3

func (opts QueryStatsOptions) Validate() error

Validate returns an error if the query stats options are invalid.

type QueryStatsTracker

type QueryStatsTracker interface {
	Lookback() time.Duration
	TrackStats(stats QueryStatsValues) error
}

QueryStatsTracker provides an interface for tracking current query stats.

func DefaultQueryStatsTracker added in v0.15.3

func DefaultQueryStatsTracker(
	instrumentOpts instrument.Options,
	queryStatsOpts QueryStatsOptions,
) QueryStatsTracker

DefaultQueryStatsTracker provides a tracker implementation that emits query stats as metrics and enforces limits.

type QueryStatsValues

type QueryStatsValues struct {
	RecentDocs int64
	NewDocs    int64
}

QueryStatsValues stores values of query stats.

Jump to

Keyboard shortcuts

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