Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractShardRequestMatchersAndAST(query string) (chunk.Predicate, error)
- func GetShuffleShardingSubring(ring ring.ReadRing, tenantID string, limits Limits) ring.ReadRing
- type BloomQuerier
- type Config
- type Gateway
- func (g *Gateway) GetChunkRef(ctx context.Context, req *logproto.GetChunkRefRequest) (result *logproto.GetChunkRefResponse, err error)
- func (g *Gateway) GetSeries(ctx context.Context, req *logproto.GetSeriesRequest) (*logproto.GetSeriesResponse, error)
- func (g *Gateway) GetShards(request *logproto.ShardsRequest, server logproto.IndexGateway_GetShardsServer) error
- func (g *Gateway) GetStats(ctx context.Context, req *logproto.IndexStatsRequest) (*logproto.IndexStatsResponse, error)
- func (g *Gateway) GetVolume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
- func (g *Gateway) LabelNamesForMetricName(ctx context.Context, req *logproto.LabelNamesForMetricNameRequest) (*logproto.LabelResponse, error)
- func (g *Gateway) LabelValuesForMetricName(ctx context.Context, req *logproto.LabelValuesForMetricNameRequest) (*logproto.LabelResponse, error)
- func (g *Gateway) QueryIndex(request *logproto.QueryIndexRequest, ...) error
- type IndexClient
- type IndexClientWithRange
- type IndexQuerier
- type Limits
- type Metrics
- type Mode
- type NoopStrategy
- type ServerInterceptors
- type ShardingStrategy
- type ShuffleShardingStrategy
Constants ¶
const ( NumTokens = 128 ReplicationFactor = 3 )
Variables ¶
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 ¶
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 ¶
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 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 ¶
RegisterFlags register all IndexGatewayClientConfig flags and all the flags of its subconfigs but with a prefix (ex: shipper).
type Gateway ¶
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 (g *Gateway) GetSeries(ctx context.Context, req *logproto.GetSeriesRequest) (*logproto.GetSeriesResponse, error)
func (*Gateway) GetShards ¶
func (g *Gateway) GetShards(request *logproto.ShardsRequest, server logproto.IndexGateway_GetShardsServer) error
func (*Gateway) GetStats ¶
func (g *Gateway) GetStats(ctx context.Context, req *logproto.IndexStatsRequest) (*logproto.IndexStatsResponse, error)
func (*Gateway) GetVolume ¶
func (g *Gateway) GetVolume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
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 ¶
func (g *Gateway) QueryIndex(request *logproto.QueryIndexRequest, server logproto.IndexGateway_QueryIndexServer) error
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 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" )
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.