Documentation
¶
Index ¶
- Constants
- type Config
- type Limits
- type Reason
- type Service
- func (s *Service) CheckReady(ctx context.Context) error
- func (s *Service) ExceedsLimits(ctx context.Context, req *proto.ExceedsLimitsRequest) (*proto.ExceedsLimitsResponse, error)
- func (s *Service) Flush()
- func (s *Service) GetAssignedPartitions(_ context.Context, _ *proto.GetAssignedPartitionsRequest) (*proto.GetAssignedPartitionsResponse, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) TransferOut(_ context.Context) error
Constants ¶
View Source
const ( DefaultActiveWindow = 2 * time.Hour DefaultRateWindow = 5 * time.Minute DefaultBucketSize = 1 * time.Minute DefaultEvictInterval = 10 * time.Minute DefaultNumPartitions = 64 DefaultConsumerGroup = "ingest-limits" )
View Source
const ( // Ring RingKey = "ingest-limits" RingName = "ingest-limits" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Enabled enables the ingest limits service.
Enabled bool `yaml:"enabled"`
// ActiveWindow defines the duration for which streams are considered
// active. Streams that have not been updated within the ActiveWindow
// are considered inactive and are not counted towards limits.
ActiveWindow time.Duration `yaml:"active_window"`
// RateWindow defines the time window for rate calculation.
// This should match the window used in Prometheus rate() queries for consistency,
// when using the `loki_ingest_limits_ingested_bytes_total` metric.
RateWindow time.Duration `yaml:"rate_window"`
// BucketSize defines the size of the buckets used to calculate stream
// rates. Smaller buckets provide more precise rates but require more
// memory.
BucketSize time.Duration `yaml:"bucket_size"`
// EvictionInterval defines the interval at which old streams are evicted.
EvictionInterval time.Duration `yaml:"eviction_interval"`
// The number of partitions for the Kafka topic used to read and write stream metadata.
// It is fixed, not a maximum.
NumPartitions int `yaml:"num_partitions"`
// LifecyclerConfig is the config to build a ring lifecycler.
LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler,omitempty"`
KafkaConfig kafka.Config `yaml:"-"`
ConsumerGroup string `yaml:"consumer_group"`
Topic string `yaml:"topic"`
}
Config represents the configuration for the ingest limits service.
func (*Config) RegisterFlags ¶
type Limits ¶ added in v3.6.0
type Limits interface {
IngestionRateBytes(userID string) float64
IngestionBurstSizeBytes(userID string) int
MaxGlobalStreamsPerUser(userID string) int
}
Limits contains all limits enforced by the limits frontend.
type Reason ¶ added in v3.6.0
type Reason int
const ( // ReasonUnknown is the zero value. ReasonUnknown Reason = iota // ReasonFailed is the reason returned when a stream cannot be checked // against limits due to an error. ReasonFailed // ReasonMaxStreams is returned when a stream cannot be accepted because // the tenant has either reached or exceeded their maximum stream limit. ReasonMaxStreams )
type Service ¶ added in v3.6.0
Service is a service that manages stream metadata limits.
func New ¶ added in v3.6.0
func New(cfg Config, limits Limits, logger log.Logger, reg prometheus.Registerer) (*Service, error)
New creates a new IngestLimits service. It initializes the metadata map and sets up a Kafka client The client is configured to consume stream metadata from a dedicated topic with the metadata suffix.
func (*Service) CheckReady ¶ added in v3.6.0
func (*Service) ExceedsLimits ¶ added in v3.6.0
func (s *Service) ExceedsLimits( ctx context.Context, req *proto.ExceedsLimitsRequest, ) (*proto.ExceedsLimitsResponse, error)
ExceedsLimits implements the proto.IngestLimitsServer interface.
func (*Service) Flush ¶ added in v3.6.0
func (s *Service) Flush()
Flush implements ring.FlushTransferer. It transfers state to another ingest limits instance.
func (*Service) GetAssignedPartitions ¶ added in v3.6.0
func (s *Service) GetAssignedPartitions( _ context.Context, _ *proto.GetAssignedPartitionsRequest, ) (*proto.GetAssignedPartitionsResponse, error)
GetAssignedPartitions implements the proto.IngestLimitsServer interface.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides gRPC client implementation for limits service.
|
Package client provides gRPC client implementation for limits service. |
|
Package frontend contains provides a frontend service for ingest limits.
|
Package frontend contains provides a frontend service for ingest limits. |
|
client
Package client provides gRPC client implementation for limits-frontend.
|
Package client provides gRPC client implementation for limits-frontend. |
Click to show internal directories.
Click to hide internal directories.