cache

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetricFromLabelMatcher

func GetMetricFromLabelMatcher(matchers *[]*prompb.LabelMatcher) string

func GetPromRequestQueryTime

func GetPromRequestQueryTime(q *prompb.Query) (int64, int64)

Types

type CacheCounter

type CacheCounter struct {
	Stats *CacheStats

	*sync.Mutex
	// contains filtered or unexported fields
}

func (*CacheCounter) Close

func (c *CacheCounter) Close()

func (*CacheCounter) Closed

func (c *CacheCounter) Closed() bool

func (*CacheCounter) GetCounter

func (c *CacheCounter) GetCounter() interface{}

type CacheHit

type CacheHit int
const (
	CacheMiss CacheHit = iota
	CacheHitPart
	CacheHitFull
	CacheKeyNotFound
	CacheKeyFoundNil
)

type CacheItem

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

func (*CacheItem) Data

func (c *CacheItem) Data() *prompb.ReadResponse

func (*CacheItem) FixupQueryTime

func (c *CacheItem) FixupQueryTime(start int64, end int64) (int64, int64)

func (*CacheItem) GetLoadCompleteSignal

func (c *CacheItem) GetLoadCompleteSignal() chan struct{}

func (*CacheItem) Hit

func (c *CacheItem) Hit(start int64, end int64) CacheHit

func (*CacheItem) Range

func (c *CacheItem) Range() int64

func (*CacheItem) Size

func (c *CacheItem) Size() uint64

type CacheKeyGenerator

type CacheKeyGenerator struct {
}

func (*CacheKeyGenerator) GenerateCacheKey

func (k *CacheKeyGenerator) GenerateCacheKey(req *model.DeepFlowPromRequest) string

generate key without query time (start/end) for cache query

type CacheStats

type CacheStats struct {
	CacheSizeOverFlow  uint64 `statsd:"cache_size_overflow"`
	CacheMiss          uint64 `statsd:"cache_miss"`
	CacheHit           uint64 `statsd:"cache_hit"`
	CacheMerge         uint64 `statsd:"cache_merge"`
	CacheMergeDuration uint64 `statsd:"cache_merge_duration"`
}

type Cacher

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

func NewCacher

func NewCacher() *Cacher

func (*Cacher) Fetch

func (c *Cacher) Fetch(key string, start, end int64) (r promql.Result, fixedStart int64, fixedEnd int64, queryRequired bool)

func (*Cacher) Merge

func (c *Cacher) Merge(key string, start, end, step int64, res promql.Result) (promql.Result, error)

func (*Cacher) Remove

func (c *Cacher) Remove(key string)

type HardKeyGenerator

type HardKeyGenerator struct {
}

func (*HardKeyGenerator) GenerateRequestKey

func (h *HardKeyGenerator) GenerateRequestKey(q model.QueryRequest) string

hard consistency for QueryHint match cache data

type RemoteReadQueryCache

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

func NewRemoteReadQueryCache

func NewRemoteReadQueryCache() *RemoteReadQueryCache

func PromReadResponseCache

func PromReadResponseCache() *RemoteReadQueryCache

func (*RemoteReadQueryCache) AddOrMerge

func (s *RemoteReadQueryCache) AddOrMerge(req *prompb.ReadRequest, resp *prompb.ReadResponse, orgFilter string, extraFilters string) *prompb.ReadResponse

func (*RemoteReadQueryCache) Get

func (s *RemoteReadQueryCache) Get(req *prompb.Query, start int64, end int64, orgFilter string, extraFilters string) (*CacheItem, CacheHit, int64, int64)

func (*RemoteReadQueryCache) Remove

func (s *RemoteReadQueryCache) Remove(req *prompb.ReadRequest, orgFilter string, extraFilter string)

type WeakKeyGenerator

type WeakKeyGenerator struct {
}

func (*WeakKeyGenerator) GenerateRequestKey

func (w *WeakKeyGenerator) GenerateRequestKey(q model.QueryRequest) string

weak consistency for match QueryHint & Prometheus Hint

Jump to

Keyboard shortcuts

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