Documentation ¶
Index ¶
- func DefaultLimitsConfig() validation.Limits
- func New(cfg Config, limits *validation.Overrides, distributor Distributor, ...) (storage.SampleAndChunkQueryable, storage.ExemplarQueryable, *promql.Engine)
- func NewChunkStoreQueryable(cfg Config, chunkStore chunkstore.ChunkStore) storage.Queryable
- func NewQueryable(distributor QueryableWithFilter, stores []QueryableWithFilter, ...) storage.Queryable
- func NewSampleAndChunkQueryable(q storage.Queryable) storage.SampleAndChunkQueryable
- type ClientConfig
- type Config
- type Distributor
- type MockDistributor
- func (m *MockDistributor) LabelNames(ctx context.Context, from, to model.Time) ([]string, error)
- func (m *MockDistributor) LabelValuesForLabelName(ctx context.Context, from, to model.Time, lbl model.LabelName, ...) ([]string, error)
- func (m *MockDistributor) MetricsForLabelMatchers(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) ([]metric.Metric, error)
- func (m *MockDistributor) MetricsMetadata(ctx context.Context) ([]scrape.MetricMetadata, error)
- func (m *MockDistributor) Query(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) (model.Matrix, error)
- func (m *MockDistributor) QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error)
- func (m *MockDistributor) QueryStream(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error)
- type QueryableWithFilter
- type SeriesWithChunks
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLimitsConfig ¶
func DefaultLimitsConfig() validation.Limits
func New ¶
func New(cfg Config, limits *validation.Overrides, distributor Distributor, stores []QueryableWithFilter, reg prometheus.Registerer, logger log.Logger) (storage.SampleAndChunkQueryable, storage.ExemplarQueryable, *promql.Engine)
New builds a queryable and promql engine.
func NewChunkStoreQueryable ¶
func NewChunkStoreQueryable(cfg Config, chunkStore chunkstore.ChunkStore) storage.Queryable
NewChunkStoreQueryable returns the storage.Queryable implementation against the chunks store.
func NewQueryable ¶
func NewQueryable(distributor QueryableWithFilter, stores []QueryableWithFilter, chunkIterFn chunkIteratorFunc, cfg Config, limits *validation.Overrides) storage.Queryable
NewQueryable creates a new Queryable for cortex.
func NewSampleAndChunkQueryable ¶
func NewSampleAndChunkQueryable(q storage.Queryable) storage.SampleAndChunkQueryable
NewSampleAndChunkQueryable creates a SampleAndChunkQueryable from a Queryable with a ChunkQueryable stub, that errors once it get's called.
Types ¶
type ClientConfig ¶
type ClientConfig struct { TLSEnabled bool `yaml:"tls_enabled"` TLS tls.ClientConfig `yaml:",inline"` }
func (*ClientConfig) RegisterFlagsWithPrefix ¶
func (cfg *ClientConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)
type Config ¶
type Config struct { MaxConcurrent int `yaml:"max_concurrent"` Timeout time.Duration `yaml:"timeout"` Iterators bool `yaml:"iterators"` BatchIterators bool `yaml:"batch_iterators"` IngesterStreaming bool `yaml:"ingester_streaming"` MaxSamples int `yaml:"max_samples"` QueryIngestersWithin time.Duration `yaml:"query_ingesters_within"` QueryStoreForLabels bool `yaml:"query_store_for_labels_enabled"` AtModifierEnabled bool `yaml:"at_modifier_enabled"` // QueryStoreAfter the time after which queries should also be sent to the store and not just ingesters. QueryStoreAfter time.Duration `yaml:"query_store_after"` MaxQueryIntoFuture time.Duration `yaml:"max_query_into_future"` // The default evaluation interval for the promql engine. // Needs to be configured for subqueries to work as it is the default // step if not specified. DefaultEvaluationInterval time.Duration `yaml:"default_evaluation_interval"` // Directory for ActiveQueryTracker. If empty, ActiveQueryTracker will be disabled and MaxConcurrent will not be applied (!). // ActiveQueryTracker logs queries that were active during the last crash, but logs them on the next startup. // However, we need to use active query tracker, otherwise we cannot limit Max Concurrent queries in the PromQL // engine. ActiveQueryTrackerDir string `yaml:"active_query_tracker_dir"` // LookbackDelta determines the time since the last sample after which a time // series is considered stale. LookbackDelta time.Duration `yaml:"lookback_delta"` // Blocks storage only. StoreGatewayAddresses string `yaml:"store_gateway_addresses"` StoreGatewayClient ClientConfig `yaml:"store_gateway_client"` SecondStoreEngine string `yaml:"second_store_engine"` UseSecondStoreBeforeTime flagext.Time `yaml:"use_second_store_before_time"` ShuffleShardingIngestersLookbackPeriod time.Duration `yaml:"shuffle_sharding_ingesters_lookback_period"` }
Config contains the configuration require to create a querier
func DefaultQuerierConfig ¶
func DefaultQuerierConfig() Config
func (*Config) GetStoreGatewayAddresses ¶
func (*Config) RegisterFlags ¶
RegisterFlags adds the flags required to config this to the given FlagSet.
type Distributor ¶
type Distributor interface { Query(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) (model.Matrix, error) QueryStream(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error) QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error) LabelValuesForLabelName(ctx context.Context, from, to model.Time, label model.LabelName, matchers ...*labels.Matcher) ([]string, error) LabelNames(context.Context, model.Time, model.Time) ([]string, error) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, matchers ...*labels.Matcher) ([]metric.Metric, error) MetricsMetadata(ctx context.Context) ([]scrape.MetricMetadata, error) }
Distributor is the read interface to the distributor, made an interface here to reduce package coupling.
type MockDistributor ¶
func (*MockDistributor) LabelNames ¶
func (*MockDistributor) LabelValuesForLabelName ¶
func (*MockDistributor) MetricsForLabelMatchers ¶
func (*MockDistributor) MetricsMetadata ¶
func (m *MockDistributor) MetricsMetadata(ctx context.Context) ([]scrape.MetricMetadata, error)
func (*MockDistributor) QueryExemplars ¶
func (m *MockDistributor) QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error)
func (*MockDistributor) QueryStream ¶
func (m *MockDistributor) QueryStream(ctx context.Context, from, to model.Time, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error)
type QueryableWithFilter ¶
type QueryableWithFilter interface { storage.Queryable // UseQueryable returns true if this queryable should be used to satisfy the query for given time range. // Query min and max time are in milliseconds since epoch. UseQueryable(now time.Time, queryMinT, queryMaxT int64) bool }
QueryableWithFilter extends Queryable interface with `UseQueryable` filtering function.
func UseAlwaysQueryable ¶
func UseAlwaysQueryable(q storage.Queryable) QueryableWithFilter
Wraps storage.Queryable into QueryableWithFilter, with no query filtering.
func UseBeforeTimestampQueryable ¶
func UseBeforeTimestampQueryable(queryable storage.Queryable, ts time.Time) QueryableWithFilter
Returns QueryableWithFilter, that is used only if query starts before given timestamp. If timestamp is zero (time.IsZero), queryable is always used.
type SeriesWithChunks ¶
type SeriesWithChunks interface { storage.Series // Returns all chunks with series data. Chunks() []chunk.Chunk }
SeriesWithChunks extends storage.Series interface with direct access to Cortex chunks.
type TestConfig ¶
type TestConfig struct { Cfg Config Distributor Distributor Stores []QueryableWithFilter }