Documentation ¶
Index ¶
- Constants
- func IsInReplicationSet(r ring.ReadRing, ringKey uint32, address string) (bool, error)
- func TokenFor(userID, labels string) uint32
- type ManagerMode
- type NoopStrategy
- type RingConfig
- 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 TenantSharding
- type TenantShuffleSharding
Constants ¶
const (
RingCheckPeriod = 3 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func IsInReplicationSet ¶
IsInReplicationSet will query the provided ring for the provided key and see if the provided address is in the resulting ReplicationSet
Types ¶
type ManagerMode ¶
type ManagerMode int
ManagerMode defines the different modes for the RingManager to execute.
The RingManager and its modes are only relevant if the Bloom Gateway is running in ring mode.
const ( // ClientMode is the RingManager mode executed by Loki components that are clients of the Bloom Gateway. // The RingManager in client will have its own ring key-value store but it won't try to register itself in the ring. ClientMode ManagerMode = iota // ServerMode is the RingManager mode execute by the Bloom Gateway. // The RingManager in server mode will register itself in the ring. ServerMode )
type NoopStrategy ¶
type NoopStrategy struct{}
NoopStrategy is an implementation of the ShardingStrategy that does not shard anything.
func (*NoopStrategy) OwnsTenant ¶
func (s *NoopStrategy) OwnsTenant(_ string) (ring.ReadRing, bool)
OwnsTenant implements TenantShuffleSharding.
type RingConfig ¶
type RingConfig struct { KVStore kv.Config `yaml:"kvstore"` HeartbeatPeriod time.Duration `yaml:"heartbeat_period"` HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"` TokensFilePath string `yaml:"tokens_file_path"` ZoneAwarenessEnabled bool `yaml:"zone_awareness_enabled"` NumTokens int `yaml:"num_tokens"` ReplicationFactor int `yaml:"replication_factor"` // Instance details InstanceID string `yaml:"instance_id" doc:"default=<hostname>"` InstanceInterfaceNames []string `yaml:"instance_interface_names" doc:"default=[<private network interfaces>]"` InstancePort int `yaml:"instance_port"` InstanceAddr string `yaml:"instance_addr"` InstanceZone string `yaml:"instance_availability_zone"` EnableIPv6 bool `yaml:"instance_enable_ipv6"` // Injected internally ListenPort int `yaml:"-"` ObservePeriod time.Duration `yaml:"-"` }
RingConfig masks the ring lifecycler config which contains many options not really required by the distributors ring. This config is used to strip down the config to the minimum, and avoid confusion to the user.
func CortexLifecyclerConfigToRingConfig ¶
func CortexLifecyclerConfigToRingConfig(cfg ring.LifecyclerConfig) RingConfig
func (*RingConfig) RegisterFlagsWithPrefix ¶
func (cfg *RingConfig) RegisterFlagsWithPrefix(flagsPrefix, storePrefix string, fs *flag.FlagSet, skip ...string)
RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet storePrefix is used to set the path in the KVStore and should end with a /
func (*RingConfig) ToLifecyclerConfig ¶
func (cfg *RingConfig) ToLifecyclerConfig(numTokens int, logger log.Logger) (ring.BasicLifecyclerConfig, error)
ToLifecyclerConfig returns a LifecyclerConfig based on the compactor ring config.
func (*RingConfig) ToRingConfig ¶
func (cfg *RingConfig) ToRingConfig(replicationFactor int) ring.Config
type RingManager ¶
type RingManager struct { services.Service Mode ManagerMode 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 Bloom Gateway (including the Bloom Gateway itself) will require a RingManager. However, the components that are clients of the Bloom Gateway will ran it in client mode while the Bloom Gateway itself will ran the manager in server mode.
func NewRingManager ¶
func NewRingManager(name string, mode ManagerMode, cfg RingConfig, rf int, tokens int, logger log.Logger, registerer prometheus.Registerer) (*RingManager, error)
NewRingManager instantiates a new RingManager instance. 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 /bloomgateway/ring.
type TenantSharding ¶
type TenantShuffleSharding ¶
type TenantShuffleSharding struct {
// contains filtered or unexported fields
}
func NewTenantShuffleSharding ¶
func NewTenantShuffleSharding( r ring.ReadRing, ringLifeCycler *ring.BasicLifecycler, shardSizeForTenant func(tenantID string) int, ) *TenantShuffleSharding
func (*TenantShuffleSharding) OwnsTenant ¶
func (s *TenantShuffleSharding) OwnsTenant(tenantID string) (ring.ReadRing, bool)