Documentation ¶
Index ¶
- Constants
- type Config
- type Gateway
- func (g *Gateway) GetChunkRef(ctx context.Context, req *indexgatewaypb.GetChunkRefRequest) (*indexgatewaypb.GetChunkRefResponse, error)
- func (g *Gateway) LabelNamesForMetricName(ctx context.Context, req *indexgatewaypb.LabelNamesForMetricNameRequest) (*indexgatewaypb.LabelResponse, error)
- func (g *Gateway) LabelValuesForMetricName(ctx context.Context, req *indexgatewaypb.LabelValuesForMetricNameRequest) (*indexgatewaypb.LabelResponse, error)
- func (g *Gateway) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc)
- func (g *Gateway) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, ...) (ring.InstanceState, ring.Tokens)
- func (g *Gateway) OnRingInstanceStopping(_ *ring.BasicLifecycler)
- func (g *Gateway) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
- func (g *Gateway) QueryIndex(request *indexgatewaypb.QueryIndexRequest, ...) error
- func (g *Gateway) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type IndexClient
- type IndexQuerier
- type Mode
- type RingCfg
Constants ¶
View Source
const ( // RingIdentifier is used as a unique name to register the Index Gateway ring. RingIdentifier = "index-gateway" // RingKey is the name of the key used to register the different Index Gateway instances in the key-value store. RingKey = "index-gateway" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 RingCfg `yaml:"ring,omitempty"` }
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, registerer prometheus.Registerer, indexQuerier IndexQuerier, indexClient IndexClient) (*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 *indexgatewaypb.GetChunkRefRequest) (*indexgatewaypb.GetChunkRefResponse, error)
func (*Gateway) LabelNamesForMetricName ¶
func (g *Gateway) LabelNamesForMetricName(ctx context.Context, req *indexgatewaypb.LabelNamesForMetricNameRequest) (*indexgatewaypb.LabelResponse, error)
func (*Gateway) LabelValuesForMetricName ¶
func (g *Gateway) LabelValuesForMetricName(ctx context.Context, req *indexgatewaypb.LabelValuesForMetricNameRequest) (*indexgatewaypb.LabelResponse, error)
func (*Gateway) OnRingInstanceHeartbeat ¶
func (g *Gateway) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc)
func (*Gateway) OnRingInstanceRegister ¶
func (g *Gateway) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, instanceID string, instanceDesc ring.InstanceDesc) (ring.InstanceState, ring.Tokens)
func (*Gateway) OnRingInstanceStopping ¶
func (g *Gateway) OnRingInstanceStopping(_ *ring.BasicLifecycler)
func (*Gateway) OnRingInstanceTokens ¶
func (g *Gateway) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
func (*Gateway) QueryIndex ¶
func (g *Gateway) QueryIndex(request *indexgatewaypb.QueryIndexRequest, server indexgatewaypb.IndexGateway_QueryIndexServer) error
type IndexClient ¶
type IndexQuerier ¶
type IndexQuerier interface { GetChunkRefs(ctx context.Context, userID string, from, through model.Time, matchers ...*labels.Matcher) ([][]chunk.Chunk, []*fetcher.Fetcher, error) LabelValuesForMetricName(ctx context.Context, userID string, from, through model.Time, metricName string, labelName string, matchers ...*labels.Matcher) ([]string, error) LabelNamesForMetricName(ctx context.Context, userID string, from, through model.Time, metricName string) ([]string, error) Stop() }
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 RingCfg ¶
type RingCfg struct { // InternalRingCfg configures the Index Gateway ring. loki_util.RingConfig `yaml:",inline"` // ReplicationFactor defines how many Index Gateway instances are assigned to each tenant. // // Whenever the store queries the ring key-value store for the Index Gateway instance responsible for tenant X, // multiple Index Gateway instances are expected to be returned as Index Gateway might be busy/locked for specific // reasons (this is assured by the spikey behavior of Index Gateway latencies). ReplicationFactor int `yaml:"replication_factor"` }
RingCfg is a wrapper for our Index Gateway ring configuration plus the replication factor.
Click to show internal directories.
Click to hide internal directories.