cache

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryConcurrency   = 10
	BackFillInterval   = 4 * timeseries.Hour
	MinRefreshInterval = timeseries.Minute
)

Variables

View Source
var DefaultCompactionConfig = CompactionConfig{
	Interval:   time.Second * 10,
	WorkersNum: 1,
	Compactors: []Compactor{
		{SrcChunkDuration: 3600, DstChunkDuration: 4 * 3600},
		{SrcChunkDuration: 4 * 3600, DstChunkDuration: 12 * 3600},
	},
}

Functions

func DefaultPrometheusClientFactory

func DefaultPrometheusClientFactory(p *db.Project) (*prom.Client, error)

func QueryId

func QueryId(projectId db.ProjectId, query string) (string, timeseries.Duration)

Types

type Cache

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

func NewCache

func NewCache(cfg Config, database, state *db.DB, promClientFactory PrometheusClientFactory) (*Cache, error)

func (*Cache) GetCacheClient

func (c *Cache) GetCacheClient(projectId db.ProjectId) *Client

func (*Cache) Updates added in v0.22.0

func (c *Cache) Updates() <-chan db.ProjectId

type Client

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

func (*Client) GetStatus

func (c *Client) GetStatus() (*Status, error)

func (*Client) GetStep added in v0.17.7

func (c *Client) GetStep(from, to timeseries.Time) (timeseries.Duration, error)

func (*Client) GetTo

func (c *Client) GetTo() (timeseries.Time, error)

func (*Client) QueryRange

func (c *Client) QueryRange(ctx context.Context, query string, from, to timeseries.Time, step timeseries.Duration) ([]model.MetricValues, error)

type CompactionConfig

type CompactionConfig struct {
	Interval   time.Duration `yaml:"interval"`
	WorkersNum int           `yaml:"workers_num"`

	Compactors []Compactor `yaml:"compactors"`
}

type CompactionTask

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

func (CompactionTask) String

func (ct CompactionTask) String() string

type Compactor

type Compactor struct {
	SrcChunkDuration timeseries.Duration `yaml:"src_chunk_duration_seconds"`
	DstChunkDuration timeseries.Duration `yaml:"dst_chunk_duration_seconds"`
}

type Config

type Config struct {
	Path       string
	GC         *GcConfig
	Compaction *CompactionConfig
}

type GcConfig

type GcConfig struct {
	Interval time.Duration `yaml:"interval"`
	TTL      time.Duration `yaml:"ttl"`
}

type PrometheusClientFactory

type PrometheusClientFactory func(project *db.Project) (*prom.Client, error)

type PrometheusQueryState

type PrometheusQueryState struct {
	ProjectId db.ProjectId
	Query     string
	LastTs    timeseries.Time
	LastError string
}

func (*PrometheusQueryState) Migrate

func (p *PrometheusQueryState) Migrate(m *db.Migrator) error

type Status

type Status struct {
	Error  string
	LagMax timeseries.Duration
	LagAvg timeseries.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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