Help us shape the future of Go! Take the 2026 Go Developer Survey

validation

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RateLimited is one of the values for the reason to discard samples.
	// Declared here to avoid duplication in ingester and distributor.
	RateLimited = "rate_limited"
)

Variables

View Source
var DiscardedSamples = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: "loki_discarded_samples_total",
		Help: "The total number of samples that were discarded.",
	},
	[]string{discardReasonLabel, "user"},
)

DiscardedSamples is a metric of the number of discarded samples, by reason.

Functions

This section is empty.

Types

type Limits

type Limits struct {
	// Distributor enforced limits.
	IngestionRate          float64       `yaml:"ingestion_rate_mb"`
	IngestionBurstSize     float64       `yaml:"ingestion_burst_size_mb"`
	MaxLabelNameLength     int           `yaml:"max_label_name_length"`
	MaxLabelValueLength    int           `yaml:"max_label_value_length"`
	MaxLabelNamesPerSeries int           `yaml:"max_label_names_per_series"`
	RejectOldSamples       bool          `yaml:"reject_old_samples"`
	RejectOldSamplesMaxAge time.Duration `yaml:"reject_old_samples_max_age"`
	CreationGracePeriod    time.Duration `yaml:"creation_grace_period"`
	EnforceMetricName      bool          `yaml:"enforce_metric_name"`

	// Ingester enforced limits.
	MaxStreamsPerUser int `yaml:"max_streams_per_user"`

	// Querier enforced limits.
	MaxChunksPerQuery          int           `yaml:"max_chunks_per_query"`
	MaxQueryLength             time.Duration `yaml:"max_query_length"`
	MaxQueryParallelism        int           `yaml:"max_query_parallelism"`
	CardinalityLimit           int           `yaml:"cardinality_limit"`
	MaxStreamsMatchersPerQuery int           `yaml:"max_streams_matchers_per_query"`

	// 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

func (*Limits) UnmarshalYAML

func (l *Limits) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Overrides

type Overrides struct {
	// 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) CardinalityLimit

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

CardinalityLimit whether to enforce the presence of a metric name.

func (*Overrides) CreationGracePeriod

func (o *Overrides) CreationGracePeriod(userID string) time.Duration

CreationGracePeriod is misnamed, and actually returns how far into the future we should accept samples.

func (*Overrides) EnforceMetricName

func (o *Overrides) EnforceMetricName(userID string) bool

EnforceMetricName whether to enforce the presence of a metric name.

func (*Overrides) IngestionBurstSize

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

IngestionBurstSize returns the burst size for ingestion rate.

func (*Overrides) IngestionRate

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

IngestionRate returns the limit on ingester rate (samples per second).

func (*Overrides) MaxChunksPerQuery

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

MaxChunksPerQuery returns the maximum number of chunks allowed per query.

func (*Overrides) MaxLabelNameLength

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

MaxLabelNameLength returns maximum length a label name can be.

func (*Overrides) MaxLabelNamesPerSeries

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

MaxLabelNamesPerSeries returns maximum number of label/value pairs timeseries.

func (*Overrides) MaxLabelValueLength

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

MaxLabelValueLength returns maximum length a label value can be. This also is the maximum length of a metric name.

func (*Overrides) MaxQueryLength

func (o *Overrides) MaxQueryLength(userID string) time.Duration

MaxQueryLength returns the limit of the length (in time) of a query.

func (*Overrides) MaxQueryParallelism

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

MaxQueryParallelism returns the limit to the number of sub-queries the frontend will process in parallel.

func (*Overrides) MaxStreamsMatchersPerQuery

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

MaxStreamsMatchersPerQuery returns the limit to number of streams matchers per query.

func (*Overrides) MaxStreamsPerUser

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

MaxStreamsPerUser returns the maximum number of streams a user is allowed to store.

func (*Overrides) RejectOldSamples

func (o *Overrides) RejectOldSamples(userID string) bool

RejectOldSamples returns true when we should reject samples older than certain age.

func (*Overrides) RejectOldSamplesMaxAge

func (o *Overrides) RejectOldSamplesMaxAge(userID string) time.Duration

RejectOldSamplesMaxAge returns the age at which samples should be rejected.

func (*Overrides) Stop

func (o *Overrides) Stop()

Stop background reloading of overrides.

Jump to

Keyboard shortcuts

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