Documentation ¶
Index ¶
- func ChunksToMatrix(chunks []Chunk) (model.Matrix, error)
- type ByID
- type Cache
- type CacheConfig
- type Chunk
- type DynamoTableManager
- type IndexEntry
- type Memcache
- type MemcacheClient
- type MemcacheConfig
- type PeriodicTableConfig
- type ReadBatch
- type S3Client
- type Schema
- type SchemaConfig
- type StorageClient
- type Store
- type StoreConfig
- type TableManagerConfig
- type WriteBatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache type caches chunks
func (*Cache) FetchChunkData ¶
func (c *Cache) FetchChunkData(ctx context.Context, userID string, chunks []Chunk) (found []Chunk, missing []Chunk, err error)
FetchChunkData gets chunks from the chunk cache.
func (*Cache) StoreChunkData ¶
StoreChunkData serializes and stores a chunk in the chunk cache.
type CacheConfig ¶
CacheConfig is config to make a Cache
func (*CacheConfig) RegisterFlags ¶
func (cfg *CacheConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type Chunk ¶
type Chunk struct { ID string `json:"-"` From model.Time `json:"from"` Through model.Time `json:"through"` Metric model.Metric `json:"metric"` // We never use Delta encoding (the zero value), so if this entry is // missing, we default to DoubleDelta. Encoding prom_chunk.Encoding `json:"encoding"` Data prom_chunk.Chunk `json:"-"` // contains filtered or unexported fields }
Chunk contains encoded timeseries data
type DynamoTableManager ¶
type DynamoTableManager struct {
// contains filtered or unexported fields
}
DynamoTableManager creates and manages the provisioned throughput on DynamoDB tables
func NewDynamoTableManager ¶
func NewDynamoTableManager(cfg TableManagerConfig) (*DynamoTableManager, error)
NewDynamoTableManager makes a new DynamoTableManager
func (*DynamoTableManager) Start ¶
func (m *DynamoTableManager) Start()
Start the DynamoTableManager
type IndexEntry ¶
type IndexEntry struct { TableName string HashValue string // For writes, RangeValue will always be set. RangeValue []byte // For reads, one of RangeValuePrefix or RangeValueStart might be set: // - If RangeValuePrefix is not nil, must read all keys with that prefix. // - If RangeValueStart is not nil, must read all keys from there onwards. // - If neither is set, must read all keys for that row. RangeValuePrefix []byte RangeValueStart []byte }
IndexEntry describes an entry in the chunk index
type Memcache ¶
type Memcache interface { GetMulti(keys []string) (map[string]*memcache.Item, error) Set(item *memcache.Item) error }
Memcache caches things
type MemcacheClient ¶
MemcacheClient is a memcache client that gets its server list from SRV records, and periodically updates that ServerList.
func NewMemcacheClient ¶
func NewMemcacheClient(cfg MemcacheConfig) *MemcacheClient
NewMemcacheClient creates a new MemcacheClient that gets its server list from SRV and updates the server list on a regular basis.
type MemcacheConfig ¶
type MemcacheConfig struct { Host string Service string Timeout time.Duration UpdateInterval time.Duration }
MemcacheConfig defines how a MemcacheClient should be constructed.
func (*MemcacheConfig) RegisterFlags ¶
func (cfg *MemcacheConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type PeriodicTableConfig ¶
type PeriodicTableConfig struct { UsePeriodicTables bool TablePrefix string TablePeriod time.Duration PeriodicTableStartAt util.DayValue }
PeriodicTableConfig for the use of periodic tables (ie, weekly talbes). Can control when to start the periodic tables, how long the period should be, and the prefix to give the tables.
func (*PeriodicTableConfig) RegisterFlags ¶
func (cfg *PeriodicTableConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type ReadBatch ¶
type ReadBatch interface { Len() int RangeValue(index int) []byte // Value is deprecated - it exists to support an old schema where the chunk // metadata was written to the chunk index. Value(index int) []byte }
ReadBatch represents the results of a QueryPages
type S3Client ¶
type S3Client interface { PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error) GetObject(*s3.GetObjectInput) (*s3.GetObjectOutput, error) }
S3Client is a client for S3
type Schema ¶
type Schema interface { // When doing a write, use this method to return the list of entries you should write to. GetWriteEntries(from, through model.Time, userID string, metricName model.LabelValue, labels model.Metric, chunkID string) ([]IndexEntry, error) // When doing a read, use these methods to return the list of entries you should query GetReadEntriesForMetric(from, through model.Time, userID string, metricName model.LabelValue) ([]IndexEntry, error) GetReadEntriesForMetricLabel(from, through model.Time, userID string, metricName model.LabelValue, labelName model.LabelName) ([]IndexEntry, error) GetReadEntriesForMetricLabelValue(from, through model.Time, userID string, metricName model.LabelValue, labelName model.LabelName, labelValue model.LabelValue) ([]IndexEntry, error) }
Schema interface defines methods to calculate the hash and range keys needed to write or read chunks from the external index.
type SchemaConfig ¶
type SchemaConfig struct { PeriodicTableConfig OriginalTableName string // After midnight on this day, we start bucketing indexes by day instead of by // hour. Only the day matters, not the time within the day. DailyBucketsFrom util.DayValue // After this time, we will only query for base64-encoded label values. Base64ValuesFrom util.DayValue // After this time, we will read and write v4 schemas. V4SchemaFrom util.DayValue // After this time, we will read and write v5 schemas. V5SchemaFrom util.DayValue }
SchemaConfig contains the config for our chunk index schemas
func (*SchemaConfig) RegisterFlags ¶
func (cfg *SchemaConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type StorageClient ¶
type StorageClient interface { // For the write path NewWriteBatch() WriteBatch BatchWrite(context.Context, WriteBatch) error // For the read path QueryPages(ctx context.Context, entry IndexEntry, callback func(result ReadBatch, lastPage bool) (shouldContinue bool)) error // For table management ListTables() ([]string, error) CreateTable(name string, readCapacity, writeCapacity int64) error DescribeTable(name string) (readCapacity, writeCapacity int64, status string, err error) UpdateTable(name string, readCapacity, writeCapacity int64) error }
StorageClient is a client for DynamoDB
func NewDynamoDBClient ¶
func NewDynamoDBClient(dynamoDBURL string) (StorageClient, string, error)
NewDynamoDBClient makes a new DynamoDBClient
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements Store
type StoreConfig ¶
type StoreConfig struct { SchemaConfig CacheConfig S3 util.URLValue DynamoDB util.URLValue // contains filtered or unexported fields }
StoreConfig specifies config for a ChunkStore
func (*StoreConfig) RegisterFlags ¶
func (cfg *StoreConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type TableManagerConfig ¶
type TableManagerConfig struct { DynamoDB util.URLValue DynamoDBPollInterval time.Duration PeriodicTableConfig // duration a table will be created before it is needed. CreationGracePeriod time.Duration MaxChunkAge time.Duration ProvisionedWriteThroughput int64 ProvisionedReadThroughput int64 InactiveWriteThroughput int64 InactiveReadThroughput int64 // contains filtered or unexported fields }
TableManagerConfig is the config for a DynamoTableManager
func (*TableManagerConfig) RegisterFlags ¶
func (cfg *TableManagerConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet
type WriteBatch ¶
WriteBatch represents a batch of writes