indexgateway

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumTokens         = 128
	ReplicationFactor = 3
)

Variables

View Source
var (
	// IndexesSync is the operation used to check the authoritative owners of an index
	// (replicas included).
	IndexesSync = ring.NewOp([]ring.InstanceState{ring.JOINING, ring.ACTIVE, ring.LEAVING}, nil)

	// IndexesRead is the operation run by the querier/query frontent to query
	// indexes via the index gateway.
	IndexesRead = ring.NewOp([]ring.InstanceState{ring.ACTIVE}, nil)
)

Functions

func ExtractShardRequestMatchersAndAST

func ExtractShardRequestMatchersAndAST(query string) (chunk.Predicate, error)

ExtractShardRequestMatchersAndAST extracts the matchers and AST from a query string. It errors if there is more than one matcher group in the AST as this is supposed to be split out during query planning before reaching this point.

func GetShuffleShardingSubring

func GetShuffleShardingSubring(ring ring.ReadRing, tenantID string, limits Limits) ring.ReadRing

GetShuffleShardingSubring returns the subring to be used for a given user. This function should be used both by index gateway servers and clients in order to guarantee the same logic is used.

Types

type BloomQuerier

type BloomQuerier interface {
	FilterChunkRefs(ctx context.Context, tenant string, from, through model.Time, chunks []*logproto.ChunkRef, plan plan.QueryPlan) ([]*logproto.ChunkRef, error)
}

type Config

type Config struct {
	// Mode configures in which mode the client will be running when querying and communicating with an Index Gateway instance.
	Mode Mode `yaml:"mode"`

	// Ring configures the ring key-value store used to save and retrieve the different Index Gateway instances.
	//
	// In case it isn't explicitly set, it follows the same behavior of the other rings (ex: using the common configuration
	// section and the ingester configuration by default).
	Ring ring.RingConfig `` /* 272-byte string literal not displayed */
}

Config configures an Index Gateway server.

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags register all IndexGatewayClientConfig flags and all the flags of its subconfigs but with a prefix (ex: shipper).

func (*Config) Validate

func (cfg *Config) Validate() error

type Gateway

type Gateway struct {
	services.Service
	// contains filtered or unexported fields
}

func NewIndexGateway

func NewIndexGateway(cfg Config, log log.Logger, r prometheus.Registerer, indexQuerier IndexQuerier, indexClients []IndexClientWithRange, bloomQuerier BloomQuerier) (*Gateway, error)

NewIndexGateway instantiates a new Index Gateway and start its services.

In case it is configured to be in ring mode, a Basic Service wrapping the ring client is started. Otherwise, it starts an Idle Service that doesn't have lifecycle hooks.

func (*Gateway) GetChunkRef

func (g *Gateway) GetChunkRef(ctx context.Context, req *logproto.GetChunkRefRequest) (result *logproto.GetChunkRefResponse, err error)

func (*Gateway) GetSeries

func (*Gateway) GetShards

func (*Gateway) GetStats

func (*Gateway) GetVolume

func (*Gateway) LabelNamesForMetricName

func (g *Gateway) LabelNamesForMetricName(ctx context.Context, req *logproto.LabelNamesForMetricNameRequest) (*logproto.LabelResponse, error)

func (*Gateway) LabelValuesForMetricName

func (g *Gateway) LabelValuesForMetricName(ctx context.Context, req *logproto.LabelValuesForMetricNameRequest) (*logproto.LabelResponse, error)

func (*Gateway) QueryIndex

type IndexClient

type IndexClient interface {
	seriesindex.ReadClient
	Stop()
}

type IndexClientWithRange

type IndexClientWithRange struct {
	IndexClient
	TableRange config.TableRange
}

type IndexQuerier

type IndexQuerier interface {
	stores.ChunkFetcher
	index.BaseReader
	index.StatsReader
	Stop()
}

type Limits

type Limits interface {
	IndexGatewayShardSize(tenantID string) int
	TSDBMaxBytesPerShard(string) int
}

type Metrics

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

func NewMetrics

func NewMetrics(r prometheus.Registerer) *Metrics

type Mode

type Mode string

Mode represents in which mode an Index Gateway instance is running.

Right now, two modes are supported: simple mode (default) and ring mode.

const (
	// SimpleMode is a mode where an Index Gateway instance solely handle all the work.
	SimpleMode Mode = "simple"

	// RingMode is a mode where different Index Gateway instances are assigned to handle different tenants.
	//
	// It is more horizontally scalable than the simple mode, but requires running a key-value store ring.
	RingMode Mode = "ring"
)

func (Mode) Set

func (i Mode) Set(v string) error

Set implements a flag interface, and is necessary to use the IndexGatewayClientMode as a flag.

func (Mode) String

func (i Mode) String() string

String implements a flag interface, and is necessary to use the IndexGatewayClientMode as a flag.

type NoopStrategy

type NoopStrategy struct{}

NoopStrategy is an implementation of the ShardingStrategy that does not filter anything. This is used when the index gateway runs in simple mode or when the index gateway runs in ring mode, but the ring manager runs in client mode.

func NewNoopStrategy

func NewNoopStrategy() *NoopStrategy

func (*NoopStrategy) FilterTenants

func (s *NoopStrategy) FilterTenants(tenantIDs []string) ([]string, error)

FilterTenants implements ShardingStrategy.

type ServerInterceptors

type ServerInterceptors struct {
	PerTenantRequestCount grpc.UnaryServerInterceptor
	// contains filtered or unexported fields
}

func NewServerInterceptors

func NewServerInterceptors(r prometheus.Registerer) *ServerInterceptors

type ShardingStrategy

type ShardingStrategy interface {
	// FilterTenants whose indexes should be loaded by the index gateway.
	// Returns the list of user IDs that should be synced by the index gateway.
	FilterTenants(tenantID []string) ([]string, error)
}

func GetShardingStrategy

func GetShardingStrategy(cfg Config, indexGatewayRingManager *lokiring.RingManager, o Limits) ShardingStrategy

GetShardingStrategy returns the correct ShardingStrategy implementation based on provided configuration.

type ShuffleShardingStrategy

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

func NewShuffleShardingStrategy

func NewShuffleShardingStrategy(r ring.ReadRing, l Limits, instanceAddr, instanceID string) *ShuffleShardingStrategy

func (*ShuffleShardingStrategy) FilterTenants

func (s *ShuffleShardingStrategy) FilterTenants(tenantIDs []string) ([]string, error)

FilterTenants implements ShardingStrategy.

Jump to

Keyboard shortcuts

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