Documentation
¶
Index ¶
- func SafeReadRing(s *RingManager) ring.ReadRing
- type Config
- type Limits
- type RingManager
- func (rm *RingManager) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc)
- func (rm *RingManager) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, _ string, ...) (ring.InstanceState, ring.Tokens)
- func (rm *RingManager) OnRingInstanceStopping(_ *ring.BasicLifecycler)
- func (rm *RingManager) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
- func (rm *RingManager) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type RingManagerMode
- type Scheduler
- func (s *Scheduler) FrontendLoop(frontend schedulerpb.SchedulerForFrontend_FrontendLoopServer) error
- func (s *Scheduler) NotifyQuerierShutdown(_ context.Context, req *schedulerpb.NotifyQuerierShutdownRequest) (*schedulerpb.NotifyQuerierShutdownResponse, error)
- func (s *Scheduler) QuerierLoop(querier schedulerpb.SchedulerForQuerier_QuerierLoopServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafeReadRing ¶
func SafeReadRing(s *RingManager) ring.ReadRing
SafeReadRing does a nil check on the Scheduler before attempting to return it's ring this is necessary as many callers of this function will only have a valid Scheduler reference if the QueryScheduler target has been specified, which is not guaranteed
Types ¶
type Config ¶
type Config struct { MaxOutstandingPerTenant int `yaml:"max_outstanding_requests_per_tenant"` MaxQueueHierarchyLevels int `yaml:"max_queue_hierarchy_levels"` QuerierForgetDelay time.Duration `yaml:"querier_forget_delay"` GRPCClientConfig grpcclient.Config `yaml:"grpc_client_config" doc:"description=This configures the gRPC client used to report errors back to the query-frontend."` // Schedulers ring UseSchedulerRing bool `yaml:"use_scheduler_ring"` SchedulerRing util.RingConfig `` /* 138-byte string literal not displayed */ }
func (*Config) RegisterFlags ¶
type Limits ¶
type Limits interface { // MaxQueriersPerUser returns max queriers to use per tenant, or 0 if shuffle sharding is disabled. MaxQueriersPerUser(user string) int }
Limits needed for the Query Scheduler - interface used for decoupling.
type RingManager ¶
type RingManager struct { services.Service RingLifecycler *ring.BasicLifecycler Ring *ring.Ring // contains filtered or unexported fields }
RingManager is a component instantiated before all the others and is responsible for the ring setup.
All Loki components that are involved with the Schedulers (including the Schedulers itself) will require a RingManager. However, the components that are clients of the Schedulers will run it in reader mode while the Schedulers itself will run the manager in member mode.
func NewRingManager ¶
func NewRingManager(managerMode RingManagerMode, cfg Config, log log.Logger, registerer prometheus.Registerer) (*RingManager, error)
NewRingManager is the recommended way of instantiating a RingManager.
The other functions will assume the RingManager was instantiated through this function.
func (*RingManager) OnRingInstanceHeartbeat ¶
func (rm *RingManager) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc)
func (*RingManager) OnRingInstanceRegister ¶
func (rm *RingManager) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, _ string, instanceDesc ring.InstanceDesc) (ring.InstanceState, ring.Tokens)
func (*RingManager) OnRingInstanceStopping ¶
func (rm *RingManager) OnRingInstanceStopping(_ *ring.BasicLifecycler)
func (*RingManager) OnRingInstanceTokens ¶
func (rm *RingManager) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens)
func (*RingManager) ServeHTTP ¶
func (rm *RingManager) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP serves the HTTP route /scheduler/ring.
type RingManagerMode ¶
type RingManagerMode int
RingManagerMode defines the different modes for the RingManager to execute.
The RingManager and its modes are only relevant if the Scheduler discovery is done using ring.
const ( // RingManagerModeReader is the RingManager mode executed by Loki components that want to discover Scheduler instances. // The RingManager in reader mode will have its own ring key-value store client, but it won't try to register itself in the ring. RingManagerModeReader RingManagerMode = iota // RingManagerModeMember is the RingManager mode execute by the Schedulers to register themselves in the ring. RingManagerModeMember )
type Scheduler ¶
Scheduler is responsible for queueing and dispatching queries to Queriers.
func NewScheduler ¶
func NewScheduler(cfg Config, limits Limits, log log.Logger, ringManager *RingManager, registerer prometheus.Registerer) (*Scheduler, error)
NewScheduler creates a new Scheduler.
func (*Scheduler) FrontendLoop ¶
func (s *Scheduler) FrontendLoop(frontend schedulerpb.SchedulerForFrontend_FrontendLoopServer) error
FrontendLoop handles connection from frontend.
func (*Scheduler) NotifyQuerierShutdown ¶
func (s *Scheduler) NotifyQuerierShutdown(_ context.Context, req *schedulerpb.NotifyQuerierShutdownRequest) (*schedulerpb.NotifyQuerierShutdownResponse, error)
func (*Scheduler) QuerierLoop ¶
func (s *Scheduler) QuerierLoop(querier schedulerpb.SchedulerForQuerier_QuerierLoopServer) error
QuerierLoop is started by querier to receive queries from scheduler.