store

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 57 Imported by: 18

Documentation

Index

Constants

View Source
const (

	// CompatibilityTypeLabelName is an artificial label that Store Gateway can optionally advertise. This is required for compatibility
	// with pre v0.8.0 Querier. Previous Queriers was strict about duplicated external labels of all StoreAPIs that had any labels.
	// Now with newer Store Gateway advertising all the external labels it has access to, there was simple case where
	// Querier was blocking Store Gateway as duplicate with sidecar.
	//
	// Newer Queriers are not strict, no duplicated external labels check is there anymore.
	// Additionally newer Queriers removes/ignore this exact labels from UI and querying.
	//
	// This label name is intentionally against Prometheus label style.
	// TODO(bwplotka): Remove it at some point.
	CompatibilityTypeLabelName = "@thanos_compatibility_store_type"
)
View Source
const (
	SUCCESS = "success"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketStore

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

BucketStore implements the store API backed by a bucket. It loads all index files to local disk.

func NewBucketStore

func NewBucketStore(
	logger log.Logger,
	reg prometheus.Registerer,
	bucket objstore.BucketReader,
	fetcher block.MetadataFetcher,
	dir string,
	indexCache storecache.IndexCache,
	maxChunkPoolBytes uint64,
	maxSampleCount uint64,
	maxConcurrent int,
	debugLogging bool,
	blockSyncConcurrency int,
	filterConfig *FilterConfig,
	enableCompatibilityLabel bool,
	enableIndexHeader bool,
) (*BucketStore, error)

NewBucketStore creates a new bucket backed store that implements the store API against an object store bucket. It is optimized to work against high latency backends.

func (*BucketStore) Close

func (s *BucketStore) Close() (err error)

Close the store.

func (*BucketStore) Info

Info implements the storepb.StoreServer interface.

func (*BucketStore) InitialSync

func (s *BucketStore) InitialSync(ctx context.Context) error

InitialSync perform blocking sync with extra step at the end to delete locally saved blocks that are no longer present in the bucket. The mismatch of these can only happen between restarts, so we can do that only once per startup.

func (*BucketStore) LabelNames

LabelNames implements the storepb.StoreServer interface.

func (*BucketStore) LabelValues

LabelValues implements the storepb.StoreServer interface.

func (*BucketStore) Series

func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_SeriesServer) (err error)

Series implements the storepb.StoreServer interface.

func (*BucketStore) SyncBlocks

func (s *BucketStore) SyncBlocks(ctx context.Context) error

SyncBlocks synchronizes the stores state with the Bucket bucket. It will reuse disk space as persistent cache based on s.dir param.

func (*BucketStore) TimeRange

func (s *BucketStore) TimeRange() (mint, maxt int64)

TimeRange returns the minimum and maximum timestamp of data available in the store.

type Client

type Client interface {
	// Client to access the store.
	storepb.StoreClient

	// LabelSets that each apply to some data exposed by the backing store.
	LabelSets() []storepb.LabelSet

	// Minimum and maximum time range of data in the store.
	TimeRange() (mint int64, maxt int64)

	String() string
	// Addr returns address of a Client.
	Addr() string
}

Client holds meta information about a store.

type FilterConfig added in v0.7.0

type FilterConfig struct {
	MinTime, MaxTime model.TimeOrDurationValue
}

FilterConfig is a configuration, which Store uses for filtering metrics based on time.

type Limiter added in v0.7.0

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

Limiter is a simple mechanism for checking if something has passed a certain threshold.

func NewLimiter added in v0.7.0

func NewLimiter(limit uint64, ctr prometheus.Counter) *Limiter

NewLimiter returns a new limiter with a specified limit. 0 disables the limit.

func (*Limiter) Check added in v0.7.0

func (l *Limiter) Check(num uint64) error

Check checks if the passed number exceeds the limits or not.

type PrometheusStore

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

PrometheusStore implements the store node API on top of the Prometheus remote read API.

func NewPrometheusStore

func NewPrometheusStore(
	logger log.Logger,
	client *http.Client,
	baseURL *url.URL,
	component component.StoreAPI,
	externalLabels func() labels.Labels,
	timestamps func() (mint int64, maxt int64),
) (*PrometheusStore, error)

NewPrometheusStore returns a new PrometheusStore that uses the given HTTP client to talk to Prometheus. It attaches the provided external labels to all results.

func (*PrometheusStore) Info

Info returns store information about the Prometheus instance. NOTE(bwplotka): MaxTime & MinTime are not accurate nor adjusted dynamically. This is fine for now, but might be needed in future.

func (*PrometheusStore) LabelNames

LabelNames returns all known label names.

func (*PrometheusStore) LabelValues

LabelValues returns all known label values for a given label name.

func (*PrometheusStore) Series

Series returns all series for a requested time range and label matcher.

type ProxyStore

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

ProxyStore implements the store API that proxies request to all given underlying stores.

func NewProxyStore

func NewProxyStore(
	logger log.Logger,
	reg prometheus.Registerer,
	stores func() []Client,
	component component.StoreAPI,
	selectorLabels labels.Labels,
	responseTimeout time.Duration,
) *ProxyStore

NewProxyStore returns a new ProxyStore that uses the given clients that implements storeAPI to fan-in all series to the client. Note that there is no deduplication support. Deduplication should be done on the highest level (just before PromQL).

func (*ProxyStore) Info

Info returns store information about the external labels this store have.

func (*ProxyStore) LabelNames

LabelNames returns all known label names.

func (*ProxyStore) LabelValues

LabelValues returns all known label values for a given label name.

func (*ProxyStore) Series

Series returns all series for a requested time range and label matcher. Requested series are taken from other stores and proxied to RPC client. NOTE: Resulted data are not trimmed exactly to min and max time range.

type ReadWriteTSDBStore added in v0.11.0

type ReadWriteTSDBStore struct {
	storepb.StoreServer
	storepb.WriteableStoreServer
}

ReadWriteTSDBStore is a TSDBStore that can also be written to.

type SampleLimiter added in v0.11.0

type SampleLimiter interface {
	Check(num uint64) error
}

type TSDBStore

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

TSDBStore implements the store API against a local TSDB instance. It attaches the provided external labels to all results. It only responds with raw data and does not support downsampling.

func NewTSDBStore

func NewTSDBStore(logger log.Logger, _ prometheus.Registerer, db *tsdb.DB, component component.SourceStoreAPI, externalLabels labels.Labels) *TSDBStore

NewTSDBStore creates a new TSDBStore.

func (*TSDBStore) Info

Info returns store information about the Prometheus instance.

func (*TSDBStore) LabelNames

LabelNames returns all known label names.

func (*TSDBStore) LabelValues

LabelValues returns all known label values for a given label name.

func (*TSDBStore) Series

Series returns all series for a requested time range and label matcher. The returned data may exceed the requested time bounds.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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