metrictank: github.com/grafana/metrictank/mdata/cache/accnt Index | Files

package accnt

import "github.com/grafana/metrictank/mdata/cache/accnt"

Index

Package Files

flat_accnt.go if.go lru.go sort_uint32.go stats.go

Variables

var (

    // metric cache.ops.metric.hit-full is how many metrics were hit fully (all needed chunks in cache)
    CacheMetricHitFull = stats.NewCounterRate32("cache.ops.metric.hit-full")

    // metric cache.ops.metric.hit-partial is how many metrics were hit partially (some of the needed chunks in cache, but not all)
    CacheMetricHitPartial = stats.NewCounterRate32("cache.ops.metric.hit-partial")

    // metric cache.ops.metric.miss is how many metrics were missed fully (no needed chunks in cache)
    CacheMetricMiss = stats.NewCounterRate32("cache.ops.metric.miss")

    // metric cache.ops.chunk.hit is how many chunks were hit
    CacheChunkHit = stats.NewCounter32("cache.ops.chunk.hit")

    // metric cache.ops.chunk.push-hot is how many chunks have been pushed into the cache because their metric is hot
    CacheChunkPushHot = stats.NewCounter32("cache.ops.chunk.push-hot")
)
var EventQSize = 100000

it's easily possible for many events to happen in one request, we never want this to fill up because otherwise events get dropped

type Accnt Uses

type Accnt interface {
    GetEvictQ() chan *EvictTarget
    AddChunk(metric schema.AMKey, ts uint32, size uint64)
    AddChunks(metric schema.AMKey, chunks []chunk.IterGen)
    HitChunk(metric schema.AMKey, ts uint32)
    HitChunks(metric schema.AMKey, chunks []chunk.IterGen)
    DelMetric(metric schema.AMKey)
    Stop()
    Reset()
}

Accnt represents an instance of cache accounting. Currently there is only one implementation called `FlatAccnt`, but it could be replaced with alternative eviction algorithms in the future if they just implement this interface.

type AddPayload Uses

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

payload to be sent with an add event

type AddsPayload Uses

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

payload to be sent with an add event

type DelMetPayload Uses

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

payload to be sent with del metric event

type EvictTarget Uses

type EvictTarget struct {
    Metric schema.AMKey
    Ts     uint32
}

EvictTarget is the definition of a chunk that should be evicted.

type FlatAccnt Uses

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

FlatAccnt implements Flat accounting. Keeps track of the chunk cache size and in which order the contained chunks have been used to last time. If it detects that the total cache size is above the given limit, it feeds the least recently used cache chunks into the evict queue, which will get consumed by the evict loop.

func NewFlatAccnt Uses

func NewFlatAccnt(maxSize uint64) *FlatAccnt

func (*FlatAccnt) AddChunk Uses

func (a *FlatAccnt) AddChunk(metric schema.AMKey, ts uint32, size uint64)

func (*FlatAccnt) AddChunks Uses

func (a *FlatAccnt) AddChunks(metric schema.AMKey, chunks []chunk.IterGen)

func (*FlatAccnt) DelMetric Uses

func (a *FlatAccnt) DelMetric(metric schema.AMKey)

func (*FlatAccnt) GetEvictQ Uses

func (a *FlatAccnt) GetEvictQ() chan *EvictTarget

func (*FlatAccnt) GetTotal Uses

func (a *FlatAccnt) GetTotal() uint64

func (*FlatAccnt) HitChunk Uses

func (a *FlatAccnt) HitChunk(metric schema.AMKey, ts uint32)

func (*FlatAccnt) HitChunks Uses

func (a *FlatAccnt) HitChunks(metric schema.AMKey, chunks []chunk.IterGen)

func (*FlatAccnt) Reset Uses

func (a *FlatAccnt) Reset()

func (*FlatAccnt) Stop Uses

func (a *FlatAccnt) Stop()

type FlatAccntEvent Uses

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

type FlatAccntMet Uses

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

type GetTotalPayload Uses

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

payload to be sent with a get total request event

type HitPayload Uses

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

payload to be sent with a hit event

type HitsPayload Uses

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

payload to be sent with a hits event

type LRU Uses

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

func NewLRU Uses

func NewLRU() *LRU

type Uint32Asc Uses

type Uint32Asc []uint32

func (Uint32Asc) Len Uses

func (su Uint32Asc) Len() int

func (Uint32Asc) Less Uses

func (su Uint32Asc) Less(i, j int) bool

func (Uint32Asc) Swap Uses

func (su Uint32Asc) Swap(i, j int)

Package accnt imports 6 packages (graph) and is imported by 3 packages. Updated 2019-08-24. Refresh now. Tools for package owners.