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 ¶
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.
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 ¶
QueryStatsValues stores values of query stats.
Click to show internal directories.
Click to hide internal directories.