overrides

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Local ingestion rate strategy
	LocalIngestionRateStrategy = "local"

	// Global ingestion rate strategy
	GlobalIngestionRateStrategy = "global"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Limits

type Limits struct {
	// Distributor enforced limits.
	IngestionRateStrategy string `yaml:"ingestion_rate_strategy"`
	IngestionRateSpans    int    `yaml:"ingestion_rate_limit"`
	IngestionMaxBatchSize int    `yaml:"ingestion_max_batch_size"`

	// Ingester enforced limits.
	MaxLocalTracesPerUser  int `yaml:"max_traces_per_user"`
	MaxGlobalTracesPerUser int `yaml:"max_global_traces_per_user"`
	MaxSpansPerTrace       int `yaml:"max_spans_per_trace"`

	// Config for overrides, convenient if it goes here.
	PerTenantOverrideConfig string        `yaml:"per_tenant_override_config"`
	PerTenantOverridePeriod time.Duration `yaml:"per_tenant_override_period"`
}

Limits describe all the limits for users; can be used to describe global default limits via flags, or per-user limits via yaml config.

func (*Limits) RegisterFlags

func (l *Limits) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

type Overrides

type Overrides struct {
	services.Service
	// contains filtered or unexported fields
}

Overrides periodically fetch a set of per-user overrides, and provides convenience functions for fetching the correct value.

func NewOverrides

func NewOverrides(defaults Limits) (*Overrides, error)

NewOverrides makes a new Overrides. We store the supplied limits in a global variable to ensure per-tenant limits are defaulted to those values. As such, the last call to NewOverrides will become the new global defaults.

func (*Overrides) IngestionMaxBatchSize

func (o *Overrides) IngestionMaxBatchSize(userID string) int

IngestionMaxBatchSize is the burst size in spans allowed for this tenant

func (*Overrides) IngestionRateSpans

func (o *Overrides) IngestionRateSpans(userID string) float64

IngestionRateSpans is the number of spans per second allowed for this tenant

func (*Overrides) IngestionRateStrategy

func (o *Overrides) IngestionRateStrategy() string

IngestionRateStrategy returns whether the ingestion rate limit should be individually applied to each distributor instance (local) or evenly shared across the cluster (global).

func (*Overrides) MaxGlobalTracesPerUser

func (o *Overrides) MaxGlobalTracesPerUser(userID string) int

MaxGlobalTracesPerUser returns the maximum number of traces a user is allowed to store across the cluster.

func (*Overrides) MaxLocalTracesPerUser

func (o *Overrides) MaxLocalTracesPerUser(userID string) int

MaxLocalTracesPerUser returns the maximum number of traces a user is allowed to store in a single ingester.

func (*Overrides) MaxSpansPerTrace

func (o *Overrides) MaxSpansPerTrace(userID string) int

MaxSpansPerTrace returns the maximum number of spans a user can have in a live trace.

type TenantLimits

type TenantLimits func(userID string) *Limits

TenantLimits is a function that returns limits for given tenant, or nil, if there are no tenant-specific limits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL