validation

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalRateLimitStrat represents a ingestion rate limiting strategy that enforces the limit
	// on a per distributor basis.
	//
	// The actual effective rate limit will be N times higher, where N is the number of distributor replicas.
	LocalIngestionRateStrategy = "local"

	// GlobalRateLimitStrat represents a ingestion rate limiting strategy that enforces the rate
	// limiting globally, configuring a per-distributor local rate limiter as "ingestion_rate / N",
	// where N is the number of distributor replicas (it's automatically adjusted if the
	// number of replicas change).
	//
	// The global strategy requires the distributors to form their own ring, which
	// is used to keep track of the current number of healthy distributor replicas.
	GlobalIngestionRateStrategy = "global"

	DefaultTSDBMaxBytesPerShard = sharding.DefaultTSDBMaxBytesPerShard

	DefaultPerTenantQueryTimeout = "1m"
)
View Source
const (
	ReasonLabel = "reason"
	// InvalidLabels is a reason for discarding log lines which have labels that cannot be parsed.
	InvalidLabels = "invalid_labels"
	MissingLabels = "missing_labels"

	MissingLabelsErrorMsg = "error at least one label pair is required per stream"
	InvalidLabelsErrorMsg = "Error parsing labels '%s' with error: %s"
	// RateLimited is one of the values for the reason to discard samples.
	// Declared here to avoid duplication in ingester and distributor.
	RateLimited         = "rate_limited"
	RateLimitedErrorMsg = "" /* 212-byte string literal not displayed */
	// LineTooLong is a reason for discarding too long log lines.
	LineTooLong         = "line_too_long"
	LineTooLongErrorMsg = "Max entry size '%d' bytes exceeded for stream '%s' while adding an entry with length '%d' bytes"
	// StreamLimit is a reason for discarding lines when we can't create a new stream
	// because the limit of active streams has been reached.
	StreamLimit         = "stream_limit"
	StreamLimitErrorMsg = "" /* 229-byte string literal not displayed */
	// StreamRateLimit is a reason for discarding lines when the streams own rate limit is hit
	// rather than the overall ingestion rate limit.
	StreamRateLimit = "per_stream_rate_limit"
	// OutOfOrder is a reason for discarding lines when Loki doesn't accept out
	// of order log lines (parameter `-ingester.unordered-writes` is set to
	// `false`) and the lines in question are older than the newest line in the
	// stream.
	OutOfOrder = "out_of_order"
	// TooFarBehind is a reason for discarding lines when Loki accepts
	// unordered ingest  (parameter `-ingester.unordered-writes` is set to
	// `true`, which is the default) and the lines in question are older than
	// half of `-ingester.max-chunk-age` compared to the newest line in the
	// stream.
	TooFarBehind = "too_far_behind"
	// GreaterThanMaxSampleAge is a reason for discarding log lines which are older than the current time - `reject_old_samples_max_age`
	GreaterThanMaxSampleAge         = "greater_than_max_sample_age"
	GreaterThanMaxSampleAgeErrorMsg = "entry for stream '%s' has timestamp too old: %v, oldest acceptable timestamp is: %v"
	// TooFarInFuture is a reason for discarding log lines which are newer than the current time + `creation_grace_period`
	TooFarInFuture         = "too_far_in_future"
	TooFarInFutureErrorMsg = "entry for stream '%s' has timestamp too new: %v"
	// MaxLabelNamesPerSeries is a reason for discarding a log line which has too many label names
	MaxLabelNamesPerSeries         = "max_label_names_per_series"
	MaxLabelNamesPerSeriesErrorMsg = "entry for stream '%s' has %d label names; limit %d"
	// LabelNameTooLong is a reason for discarding a log line which has a label name too long
	LabelNameTooLong         = "label_name_too_long"
	LabelNameTooLongErrorMsg = "stream '%s' has label name too long: '%s'"
	// LabelValueTooLong is a reason for discarding a log line which has a lable value too long
	LabelValueTooLong         = "label_value_too_long"
	LabelValueTooLongErrorMsg = "stream '%s' has label value too long: '%s'"
	// DuplicateLabelNames is a reason for discarding a log line which has duplicate label names
	DuplicateLabelNames                  = "duplicate_label_names"
	DuplicateLabelNamesErrorMsg          = "stream '%s' has duplicate label name: '%s'"
	DisallowedStructuredMetadata         = "disallowed_structured_metadata"
	DisallowedStructuredMetadataErrorMsg = "" /* 175-byte string literal not displayed */
	StructuredMetadataTooLarge           = "structured_metadata_too_large"
	StructuredMetadataTooLargeErrorMsg   = "" /* 184-byte string literal not displayed */
	StructuredMetadataTooMany            = "structured_metadata_too_many"
	StructuredMetadataTooManyErrorMsg    = "" /* 187-byte string literal not displayed */
	BlockedIngestion                     = "blocked_ingestion"
	BlockedIngestionErrorMsg             = "ingestion blocked for user %s until '%s' with status code '%d'"
)

Variables

View Source
var DiscardedBytes = promauto.NewCounterVec(
	prometheus.CounterOpts{
		Namespace: constants.Loki,
		Name:      "discarded_bytes_total",
		Help:      "The total number of bytes that were discarded.",
	},
	[]string{ReasonLabel, "tenant"},
)

DiscardedBytes is a metric of the total discarded bytes, by reason.

View Source
var DiscardedSamples = promauto.NewCounterVec(
	prometheus.CounterOpts{
		Namespace: constants.Loki,
		Name:      "discarded_samples_total",
		Help:      "The total number of samples that were discarded.",
	},
	[]string{ReasonLabel, "tenant"},
)

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

View Source
var LineLengthHist = promauto.NewHistogram(prometheus.HistogramOpts{
	Namespace: constants.Loki,
	Name:      "bytes_per_line",
	Help:      "The total number of bytes per line.",
	Buckets:   prometheus.ExponentialBuckets(1, 8, 8),
})
View Source
var MutatedBytes = promauto.NewCounterVec(
	prometheus.CounterOpts{
		Namespace: constants.Loki,
		Name:      "mutated_bytes_total",
		Help:      "The total number of bytes that have been mutated.",
	},
	[]string{ReasonLabel, "truncated"},
)

MutatedBytes is a metric of the total mutated bytes, by reason.

View Source
var MutatedSamples = promauto.NewCounterVec(
	prometheus.CounterOpts{
		Namespace: constants.Loki,
		Name:      "mutated_samples_total",
		Help:      "The total number of samples that have been mutated.",
	},
	[]string{ReasonLabel, "truncated"},
)

MutatedSamples is a metric of the total number of lines mutated, by reason.

View Source
var Unlimited = RateLimit{
	Limit: rate.Inf,
	Burst: 0,
}

Functions

func SetDefaultLimitsForYAMLUnmarshalling

func SetDefaultLimitsForYAMLUnmarshalling(defaults Limits)

SetDefaultLimitsForYAMLUnmarshalling sets global default limits, used when loading Limits from YAML files. This is used to ensure per-tenant limits are defaulted to those values.

Types

type ErrStreamRateLimit

type ErrStreamRateLimit struct {
	RateLimit flagext.ByteSize
	Labels    string
	Bytes     flagext.ByteSize
}

func (*ErrStreamRateLimit) Error

func (e *ErrStreamRateLimit) Error() string

type ExportedLimits

type ExportedLimits interface {
	AllByUserID() map[string]*Limits
	DefaultLimits() *Limits
}

type LimitError

type LimitError string

LimitError are errors that do not comply with the limits specified.

func (LimitError) Error

func (e LimitError) Error() string

type Limits

type Limits struct {
	// Distributor enforced limits.
	IngestionRateStrategy       string           `yaml:"ingestion_rate_strategy" json:"ingestion_rate_strategy"`
	IngestionRateMB             float64          `yaml:"ingestion_rate_mb" json:"ingestion_rate_mb"`
	IngestionBurstSizeMB        float64          `yaml:"ingestion_burst_size_mb" json:"ingestion_burst_size_mb"`
	MaxLabelNameLength          int              `yaml:"max_label_name_length" json:"max_label_name_length"`
	MaxLabelValueLength         int              `yaml:"max_label_value_length" json:"max_label_value_length"`
	MaxLabelNamesPerSeries      int              `yaml:"max_label_names_per_series" json:"max_label_names_per_series"`
	RejectOldSamples            bool             `yaml:"reject_old_samples" json:"reject_old_samples"`
	RejectOldSamplesMaxAge      model.Duration   `yaml:"reject_old_samples_max_age" json:"reject_old_samples_max_age"`
	CreationGracePeriod         model.Duration   `yaml:"creation_grace_period" json:"creation_grace_period"`
	MaxLineSize                 flagext.ByteSize `yaml:"max_line_size" json:"max_line_size"`
	MaxLineSizeTruncate         bool             `yaml:"max_line_size_truncate" json:"max_line_size_truncate"`
	IncrementDuplicateTimestamp bool             `yaml:"increment_duplicate_timestamp" json:"increment_duplicate_timestamp"`
	DiscoverServiceName         []string         `yaml:"discover_service_name" json:"discover_service_name"`
	DiscoverLogLevels           bool             `yaml:"discover_log_levels" json:"discover_log_levels"`

	// Ingester enforced limits.
	UseOwnedStreamCount     bool             `yaml:"use_owned_stream_count" json:"use_owned_stream_count"`
	MaxLocalStreamsPerUser  int              `yaml:"max_streams_per_user" json:"max_streams_per_user"`
	MaxGlobalStreamsPerUser int              `yaml:"max_global_streams_per_user" json:"max_global_streams_per_user"`
	UnorderedWrites         bool             `yaml:"unordered_writes" json:"unordered_writes"`
	PerStreamRateLimit      flagext.ByteSize `yaml:"per_stream_rate_limit" json:"per_stream_rate_limit"`
	PerStreamRateLimitBurst flagext.ByteSize `yaml:"per_stream_rate_limit_burst" json:"per_stream_rate_limit_burst"`

	// Querier enforced limits.
	MaxChunksPerQuery          int              `yaml:"max_chunks_per_query" json:"max_chunks_per_query"`
	MaxQuerySeries             int              `yaml:"max_query_series" json:"max_query_series"`
	MaxQueryLookback           model.Duration   `yaml:"max_query_lookback" json:"max_query_lookback"`
	MaxQueryLength             model.Duration   `yaml:"max_query_length" json:"max_query_length"`
	MaxQueryRange              model.Duration   `yaml:"max_query_range" json:"max_query_range"`
	MaxQueryParallelism        int              `yaml:"max_query_parallelism" json:"max_query_parallelism"`
	TSDBMaxQueryParallelism    int              `yaml:"tsdb_max_query_parallelism" json:"tsdb_max_query_parallelism"`
	TSDBMaxBytesPerShard       flagext.ByteSize `yaml:"tsdb_max_bytes_per_shard" json:"tsdb_max_bytes_per_shard"`
	TSDBShardingStrategy       string           `yaml:"tsdb_sharding_strategy" json:"tsdb_sharding_strategy"`
	TSDBPrecomputeChunks       bool             `yaml:"tsdb_precompute_chunks" json:"tsdb_precompute_chunks"`
	CardinalityLimit           int              `yaml:"cardinality_limit" json:"cardinality_limit"`
	MaxStreamsMatchersPerQuery int              `yaml:"max_streams_matchers_per_query" json:"max_streams_matchers_per_query"`
	MaxConcurrentTailRequests  int              `yaml:"max_concurrent_tail_requests" json:"max_concurrent_tail_requests"`
	MaxEntriesLimitPerQuery    int              `yaml:"max_entries_limit_per_query" json:"max_entries_limit_per_query"`
	MaxCacheFreshness          model.Duration   `yaml:"max_cache_freshness_per_query" json:"max_cache_freshness_per_query"`
	MaxMetadataCacheFreshness  model.Duration   `yaml:"max_metadata_cache_freshness" json:"max_metadata_cache_freshness"`
	MaxStatsCacheFreshness     model.Duration   `yaml:"max_stats_cache_freshness" json:"max_stats_cache_freshness"`
	MaxQueriersPerTenant       uint             `yaml:"max_queriers_per_tenant" json:"max_queriers_per_tenant"`
	MaxQueryCapacity           float64          `yaml:"max_query_capacity" json:"max_query_capacity"`
	QueryReadyIndexNumDays     int              `yaml:"query_ready_index_num_days" json:"query_ready_index_num_days"`
	QueryTimeout               model.Duration   `yaml:"query_timeout" json:"query_timeout"`

	// Query frontend enforced limits. The default is actually parameterized by the queryrange config.
	QuerySplitDuration               model.Duration   `yaml:"split_queries_by_interval" json:"split_queries_by_interval"`
	MetadataQuerySplitDuration       model.Duration   `yaml:"split_metadata_queries_by_interval" json:"split_metadata_queries_by_interval"`
	RecentMetadataQuerySplitDuration model.Duration   `yaml:"split_recent_metadata_queries_by_interval" json:"split_recent_metadata_queries_by_interval"`
	RecentMetadataQueryWindow        model.Duration   `yaml:"recent_metadata_query_window" json:"recent_metadata_query_window"`
	InstantMetricQuerySplitDuration  model.Duration   `yaml:"split_instant_metric_queries_by_interval" json:"split_instant_metric_queries_by_interval"`
	IngesterQuerySplitDuration       model.Duration   `yaml:"split_ingester_queries_by_interval" json:"split_ingester_queries_by_interval"`
	MinShardingLookback              model.Duration   `yaml:"min_sharding_lookback" json:"min_sharding_lookback"`
	MaxQueryBytesRead                flagext.ByteSize `yaml:"max_query_bytes_read" json:"max_query_bytes_read"`
	MaxQuerierBytesRead              flagext.ByteSize `yaml:"max_querier_bytes_read" json:"max_querier_bytes_read"`
	VolumeEnabled                    bool             `yaml:"volume_enabled" json:"volume_enabled" doc:"description=Enable log-volume endpoints."`
	VolumeMaxSeries                  int              `` /* 132-byte string literal not displayed */

	// Ruler defaults and limits.
	RulerMaxRulesPerRuleGroup   int                              `yaml:"ruler_max_rules_per_rule_group" json:"ruler_max_rules_per_rule_group"`
	RulerMaxRuleGroupsPerTenant int                              `yaml:"ruler_max_rule_groups_per_tenant" json:"ruler_max_rule_groups_per_tenant"`
	RulerAlertManagerConfig     *ruler_config.AlertManagerConfig `yaml:"ruler_alertmanager_config" json:"ruler_alertmanager_config" doc:"hidden"`
	RulerTenantShardSize        int                              `yaml:"ruler_tenant_shard_size" json:"ruler_tenant_shard_size"`

	// this field is the inversion of the general remote_write.enabled because the zero value of a boolean is false,
	// and if it were ruler_remote_write_enabled, it would be impossible to know if the value was explicitly set or default
	RulerRemoteWriteDisabled bool `yaml:"ruler_remote_write_disabled" json:"ruler_remote_write_disabled" doc:"description=Disable recording rules remote-write."`

	// deprecated use RulerRemoteWriteConfig instead.
	RulerRemoteWriteURL string `` /* 173-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteTimeout time.Duration `` /* 188-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteHeaders OverwriteMarshalingStringMap `` /* 278-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteRelabelConfigs []*util.RelabelConfig `` /* 218-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueCapacity int `` /* 398-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueMinShards int `` /* 209-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueMaxShards int `` /* 209-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueMaxSamplesPerSend int `` /* 211-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueBatchSendDeadline time.Duration `` /* 216-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueMinBackoff time.Duration `` /* 208-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueMaxBackoff time.Duration `` /* 178-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteQueueRetryOnRateLimit bool `` /* 294-byte string literal not displayed */
	// deprecated use RulerRemoteWriteConfig instead
	RulerRemoteWriteSigV4Config *sigv4.SigV4Config `` /* 241-byte string literal not displayed */

	RulerRemoteWriteConfig map[string]config.RemoteWriteConfig `` /* 205-byte string literal not displayed */

	// TODO(dannyk): possible enhancement is to align this with rule group interval
	RulerRemoteEvaluationTimeout         time.Duration `` /* 183-byte string literal not displayed */
	RulerRemoteEvaluationMaxResponseSize int64         `` /* 248-byte string literal not displayed */

	// Global and per tenant deletion mode
	DeletionMode string `yaml:"deletion_mode" json:"deletion_mode"`

	// Global and per tenant retention
	RetentionPeriod model.Duration    `yaml:"retention_period" json:"retention_period"`
	StreamRetention []StreamRetention `` /* 568-byte string literal not displayed */

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

	// Deprecated
	CompactorDeletionEnabled bool `yaml:"allow_deletes" json:"allow_deletes" doc:"deprecated|description=Use deletion_mode per tenant configuration instead."`

	ShardStreams shardstreams.Config `yaml:"shard_streams" json:"shard_streams" doc:"description=Define streams sharding behavior."`

	BlockedQueries []*validation.BlockedQuery `yaml:"blocked_queries,omitempty" json:"blocked_queries,omitempty"`

	RequiredLabels       []string `` /* 126-byte string literal not displayed */
	RequiredNumberLabels int      `` /* 152-byte string literal not displayed */

	IndexGatewayShardSize int `yaml:"index_gateway_shard_size" json:"index_gateway_shard_size"`

	BloomGatewayShardSize        int           `yaml:"bloom_gateway_shard_size" json:"bloom_gateway_shard_size" category:"experimental"`
	BloomGatewayEnabled          bool          `yaml:"bloom_gateway_enable_filtering" json:"bloom_gateway_enable_filtering" category:"experimental"`
	BloomGatewayCacheKeyInterval time.Duration `yaml:"bloom_gateway_cache_key_interval" json:"bloom_gateway_cache_key_interval" category:"experimental"`

	BloomBuildMaxBuilders       int           `yaml:"bloom_build_max_builders" json:"bloom_build_max_builders" category:"experimental"`
	BloomBuildTaskMaxRetries    int           `yaml:"bloom_build_task_max_retries" json:"bloom_build_task_max_retries" category:"experimental"`
	BloomBuilderResponseTimeout time.Duration `yaml:"bloom_build_builder_response_timeout" json:"bloom_build_builder_response_timeout" category:"experimental"`

	BloomCreationEnabled       bool    `yaml:"bloom_creation_enabled" json:"bloom_creation_enabled" category:"experimental"`
	BloomSplitSeriesKeyspaceBy int     `yaml:"bloom_split_series_keyspace_by" json:"bloom_split_series_keyspace_by" category:"experimental"`
	BloomNGramLength           int     `yaml:"bloom_ngram_length" json:"bloom_ngram_length" category:"experimental"`
	BloomNGramSkip             int     `yaml:"bloom_ngram_skip" json:"bloom_ngram_skip" category:"experimental"`
	BloomFalsePositiveRate     float64 `yaml:"bloom_false_positive_rate" json:"bloom_false_positive_rate" category:"experimental"`
	BloomBlockEncoding         string  `yaml:"bloom_block_encoding" json:"bloom_block_encoding" category:"experimental"`

	BloomMaxBlockSize flagext.ByteSize `yaml:"bloom_max_block_size" json:"bloom_max_block_size" category:"experimental"`
	BloomMaxBloomSize flagext.ByteSize `yaml:"bloom_max_bloom_size" json:"bloom_max_bloom_size" category:"experimental"`

	AllowStructuredMetadata           bool                  `` /* 159-byte string literal not displayed */
	MaxStructuredMetadataSize         flagext.ByteSize      `` /* 149-byte string literal not displayed */
	MaxStructuredMetadataEntriesCount int                   `` /* 167-byte string literal not displayed */
	OTLPConfig                        push.OTLPConfig       `yaml:"otlp_config" json:"otlp_config" doc:"description=OTLP log ingestion configurations"`
	GlobalOTLPConfig                  push.GlobalOTLPConfig `yaml:"-" json:"-"`

	BlockIngestionUntil      dskit_flagext.Time `yaml:"block_ingestion_until" json:"block_ingestion_until"`
	BlockIngestionStatusCode int                `yaml:"block_ingestion_status_code" json:"block_ingestion_status_code"`
}

Limits describe all the limits for users; can be used to describe global default limits via flags, or per-user limits via yaml config. NOTE: we use custom `model.Duration` instead of standard `time.Duration` because, to support user-friendly duration format (e.g: "1h30m45s") in JSON value.

func (*Limits) RegisterFlags

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

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

func (*Limits) SetGlobalOTLPConfig

func (l *Limits) SetGlobalOTLPConfig(cfg push.GlobalOTLPConfig)

SetGlobalOTLPConfig set GlobalOTLPConfig which is used while unmarshaling per-tenant otlp config to use the default list of resource attributes picked as index labels.

func (*Limits) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Limits) Validate

func (l *Limits) Validate() error

Validate validates that this limits config is valid.

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, tenantLimits TenantLimits) (*Overrides, error)

NewOverrides makes a new Overrides.

func (*Overrides) AllByUserID

func (o *Overrides) AllByUserID() map[string]*Limits

func (*Overrides) AllowStructuredMetadata

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

func (*Overrides) BlockIngestionStatusCode added in v3.2.0

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

func (*Overrides) BlockIngestionUntil added in v3.2.0

func (o *Overrides) BlockIngestionUntil(userID string) time.Time

func (*Overrides) BlockedQueries

func (o *Overrides) BlockedQueries(_ context.Context, userID string) []*validation.BlockedQuery

func (*Overrides) BloomBlockEncoding

func (o *Overrides) BloomBlockEncoding(userID string) string

func (*Overrides) BloomBuildMaxBuilders added in v3.1.0

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

func (*Overrides) BloomCreationEnabled added in v3.1.0

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

func (*Overrides) BloomFalsePositiveRate

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

func (*Overrides) BloomGatewayCacheKeyInterval

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

func (*Overrides) BloomGatewayEnabled

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

func (*Overrides) BloomGatewayShardSize

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

func (*Overrides) BloomMaxBlockSize added in v3.2.0

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

func (*Overrides) BloomMaxBloomSize added in v3.2.0

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

func (*Overrides) BloomNGramLength

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

func (*Overrides) BloomNGramSkip

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

func (*Overrides) BloomSplitSeriesKeyspaceBy added in v3.1.0

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

func (*Overrides) BloomTaskMaxRetries added in v3.1.0

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

func (*Overrides) BuilderResponseTimeout added in v3.1.0

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

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) DefaultLimits

func (o *Overrides) DefaultLimits() *Limits

func (*Overrides) DeletionMode

func (o *Overrides) DeletionMode(userID string) string

func (*Overrides) DiscoverLogLevels

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

func (*Overrides) DiscoverServiceName

func (o *Overrides) DiscoverServiceName(userID string) []string

func (*Overrides) IncrementDuplicateTimestamps

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

func (*Overrides) IndexGatewayShardSize

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

func (*Overrides) IngesterQuerySplitDuration

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

IngesterQuerySplitDuration returns the tenant specific splitby interval applied in the query frontend when querying during the `query_ingesters_within` window.

func (*Overrides) IngestionBurstSizeBytes

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

IngestionBurstSizeBytes returns the burst size for ingestion rate.

func (*Overrides) IngestionRateBytes

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

IngestionRateBytes returns the limit on ingester rate (MBs per second).

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) InstantMetricQuerySplitDuration

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

InstantMetricQuerySplitDuration returns the tenant specific instant metric queries splitby interval applied in the query frontend.

func (*Overrides) MaxCacheFreshness

func (o *Overrides) MaxCacheFreshness(_ context.Context, userID string) time.Duration

func (*Overrides) MaxChunksPerQuery

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

MaxChunksPerQuery returns the maximum number of chunks allowed per query.

func (*Overrides) MaxChunksPerQueryFromStore

func (o *Overrides) MaxChunksPerQueryFromStore(_ string) int

Compatibility with Cortex interface, this method is set to be removed in 1.12, so nooping in Loki until then.

func (*Overrides) MaxConcurrentTailRequests

func (o *Overrides) MaxConcurrentTailRequests(_ context.Context, userID string) int

MaxConcurrentTailRequests returns the limit to number of concurrent tail requests.

func (*Overrides) MaxEntriesLimitPerQuery

func (o *Overrides) MaxEntriesLimitPerQuery(_ context.Context, userID string) int

MaxEntriesLimitPerQuery returns the limit to number of entries the querier should return per query.

func (*Overrides) MaxGlobalStreamsPerUser

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

MaxGlobalStreamsPerUser returns the maximum number of streams a user is allowed to store across the cluster.

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) MaxLineSize

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

MaxLineSize returns the maximum size in bytes the distributor should allow.

func (*Overrides) MaxLineSizeTruncate

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

MaxLineSizeTruncate returns whether lines longer than max should be truncated.

func (*Overrides) MaxLocalStreamsPerUser

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

MaxLocalStreamsPerUser returns the maximum number of streams a user is allowed to store in a single ingester.

func (*Overrides) MaxMetadataCacheFreshness

func (o *Overrides) MaxMetadataCacheFreshness(_ context.Context, userID string) time.Duration

func (*Overrides) MaxQuerierBytesRead

func (o *Overrides) MaxQuerierBytesRead(_ context.Context, userID string) int

MaxQuerierBytesRead returns the maximum bytes a sub query can read after splitting and sharding.

func (*Overrides) MaxQueriersPerUser

func (o *Overrides) MaxQueriersPerUser(userID string) uint

MaxQueriersPerUser returns the maximum number of queriers that can handle requests for this user.

func (*Overrides) MaxQueryBytesRead

func (o *Overrides) MaxQueryBytesRead(_ context.Context, userID string) int

MaxQueryBytesRead returns the maximum bytes a query can read.

func (*Overrides) MaxQueryCapacity

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

MaxQueryCapacity returns how much of the available query capacity can be used by this user..

func (*Overrides) MaxQueryLength

func (o *Overrides) MaxQueryLength(_ context.Context, userID string) time.Duration

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

func (*Overrides) MaxQueryLookback

func (o *Overrides) MaxQueryLookback(_ context.Context, userID string) time.Duration

MaxQueryLookback returns the max lookback period of queries.

func (*Overrides) MaxQueryParallelism

func (o *Overrides) MaxQueryParallelism(_ context.Context, userID string) int

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

func (*Overrides) MaxQueryRange

func (o *Overrides) MaxQueryRange(_ context.Context, userID string) time.Duration

MaxQueryRange returns the limit for the max [range] value that can be in a range query

func (*Overrides) MaxQuerySeries

func (o *Overrides) MaxQuerySeries(_ context.Context, userID string) int

MaxQuerySeries returns the limit of the series of metric queries.

func (*Overrides) MaxStatsCacheFreshness

func (o *Overrides) MaxStatsCacheFreshness(_ context.Context, userID string) time.Duration

func (*Overrides) MaxStreamsMatchersPerQuery

func (o *Overrides) MaxStreamsMatchersPerQuery(_ context.Context, userID string) int

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

func (*Overrides) MaxStructuredMetadataCount

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

func (*Overrides) MaxStructuredMetadataSize

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

func (*Overrides) MetadataQuerySplitDuration

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

MetadataQuerySplitDuration returns the tenant specific metadata splitby interval applied in the query frontend.

func (*Overrides) MinShardingLookback

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

MinShardingLookback returns the tenant specific min sharding lookback (e.g from when we should start sharding).

func (*Overrides) OTLPConfig

func (o *Overrides) OTLPConfig(userID string) push.OTLPConfig

func (*Overrides) PerStreamRateLimit

func (o *Overrides) PerStreamRateLimit(userID string) RateLimit

func (*Overrides) QueryReadyIndexNumDays

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

QueryReadyIndexNumDays returns the number of days for which we have to be query ready for a user.

func (*Overrides) QuerySplitDuration

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

QuerySplitDuration returns the tenant specific splitby interval applied in the query frontend.

func (*Overrides) QueryTimeout

func (o *Overrides) QueryTimeout(_ context.Context, userID string) time.Duration

func (*Overrides) RecentMetadataQuerySplitDuration

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

RecentMetadataQuerySplitDuration returns the tenant specific splitby interval for recent metadata queries.

func (*Overrides) RecentMetadataQueryWindow

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

RecentMetadataQueryWindow returns the tenant specific time window used to determine recent metadata queries.

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) RequiredLabels

func (o *Overrides) RequiredLabels(_ context.Context, userID string) []string

func (*Overrides) RequiredNumberLabels

func (o *Overrides) RequiredNumberLabels(_ context.Context, userID string) int

func (*Overrides) RetentionPeriod

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

RetentionPeriod returns the retention period for a given user.

func (*Overrides) RulerAlertManagerConfig

func (o *Overrides) RulerAlertManagerConfig(userID string) *ruler_config.AlertManagerConfig

RulerAlertManagerConfig returns the alertmanager configurations to use for a given user.

func (*Overrides) RulerMaxRuleGroupsPerTenant

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

RulerMaxRuleGroupsPerTenant returns the maximum number of rule groups for a given user.

func (*Overrides) RulerMaxRulesPerRuleGroup

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

RulerMaxRulesPerRuleGroup returns the maximum number of rules per rule group for a given user.

func (*Overrides) RulerRemoteEvaluationMaxResponseSize

func (o *Overrides) RulerRemoteEvaluationMaxResponseSize(userID string) int64

RulerRemoteEvaluationMaxResponseSize returns the maximum allowable response size from a remote rule evaluation for a given user.

func (*Overrides) RulerRemoteEvaluationTimeout

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

RulerRemoteEvaluationTimeout returns the duration after which to timeout a remote rule evaluation request for a given user.

func (*Overrides) RulerRemoteWriteConfig

func (o *Overrides) RulerRemoteWriteConfig(userID string, id string) *config.RemoteWriteConfig

RulerRemoteWriteConfig returns the remote-write configurations to use for a given user and a given remote client.

func (*Overrides) RulerRemoteWriteDisabled

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

RulerRemoteWriteDisabled returns whether remote-write is disabled for a given user or not.

func (*Overrides) RulerRemoteWriteHeaders deprecated

func (o *Overrides) RulerRemoteWriteHeaders(userID string) map[string]string

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteHeaders returns the headers to use in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteQueueBatchSendDeadline deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueBatchSendDeadline returns the maximum time a sample will be buffered before being discarded for a given user.

func (*Overrides) RulerRemoteWriteQueueCapacity deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueCapacity returns the queue capacity to use in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteQueueMaxBackoff deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueMaxBackoff returns the maximum time for an exponential backoff for a given user.

func (*Overrides) RulerRemoteWriteQueueMaxSamplesPerSend deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueMaxSamplesPerSend returns the max samples to send in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteQueueMaxShards deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueMaxShards returns the maximum shards to use in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteQueueMinBackoff deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueMinBackoff returns the minimum time for an exponential backoff for a given user.

func (*Overrides) RulerRemoteWriteQueueMinShards deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueMinShards returns the minimum shards to use in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteQueueRetryOnRateLimit deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteQueueRetryOnRateLimit returns whether to retry failed remote-write requests (429 response) for a given user.

func (*Overrides) RulerRemoteWriteRelabelConfigs deprecated

func (o *Overrides) RulerRemoteWriteRelabelConfigs(userID string) []*util.RelabelConfig

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteRelabelConfigs returns the write relabel configs to use in a remote-write for a given user.

func (*Overrides) RulerRemoteWriteSigV4Config deprecated

func (o *Overrides) RulerRemoteWriteSigV4Config(userID string) *sigv4.SigV4Config

Deprecated: use RulerRemoteWriteConfig instead

func (*Overrides) RulerRemoteWriteTimeout deprecated

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

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteTimeout returns the duration after which to timeout a remote-write request for a given user.

func (*Overrides) RulerRemoteWriteURL deprecated

func (o *Overrides) RulerRemoteWriteURL(userID string) string

Deprecated: use RulerRemoteWriteConfig instead RulerRemoteWriteURL returns the remote-write URL to use for a given user.

func (*Overrides) RulerTenantShardSize

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

RulerTenantShardSize returns shard size (number of rulers) used by this tenant when using shuffle-sharding strategy.

func (*Overrides) ShardStreams

func (o *Overrides) ShardStreams(userID string) shardstreams.Config

func (*Overrides) StreamRetention

func (o *Overrides) StreamRetention(userID string) []StreamRetention

StreamRetention returns the retention period for a given user.

func (*Overrides) TSDBMaxBytesPerShard

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

TSDBMaxBytesPerShard returns the maximum number of bytes assigned to a specific shard in a tsdb query

func (*Overrides) TSDBMaxQueryParallelism

func (o *Overrides) TSDBMaxQueryParallelism(_ context.Context, userID string) int

TSDBMaxQueryParallelism returns the limit to the number of sub-queries the frontend will process in parallel for TSDB schemas.

func (*Overrides) TSDBPrecomputeChunks added in v3.1.0

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

func (*Overrides) TSDBShardingStrategy

func (o *Overrides) TSDBShardingStrategy(userID string) string

TSDBShardingStrategy returns the sharding strategy to use in query planning.

func (*Overrides) UnorderedWrites

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

func (*Overrides) UseOwnedStreamCount added in v3.1.0

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

func (*Overrides) VolumeEnabled

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

VolumeEnabled returns whether volume endpoints are enabled for a user.

func (*Overrides) VolumeMaxSeries

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

type OverridesExporter

type OverridesExporter struct {
	// contains filtered or unexported fields
}

func NewOverridesExporter

func NewOverridesExporter(overrides ExportedLimits) *OverridesExporter

TODO(jordanrushing): break out overrides from defaults?

func (*OverridesExporter) Collect

func (oe *OverridesExporter) Collect(ch chan<- prometheus.Metric)

func (*OverridesExporter) Describe

func (oe *OverridesExporter) Describe(ch chan<- *prometheus.Desc)

type OverwriteMarshalingStringMap

type OverwriteMarshalingStringMap struct {
	// contains filtered or unexported fields
}

OverwriteMarshalingStringMap will overwrite the src map when unmarshaling as opposed to merging.

func NewOverwriteMarshalingStringMap

func NewOverwriteMarshalingStringMap(m map[string]string) OverwriteMarshalingStringMap

func (*OverwriteMarshalingStringMap) Map

func (OverwriteMarshalingStringMap) MarshalJSON

func (sm OverwriteMarshalingStringMap) MarshalJSON() ([]byte, error)

MarshalJSON explicitly uses the the type receiver and not pointer receiver or it won't be called

func (OverwriteMarshalingStringMap) MarshalYAML

func (sm OverwriteMarshalingStringMap) MarshalYAML() (interface{}, error)

MarshalYAML explicitly uses the the type receiver and not pointer receiver or it won't be called

func (*OverwriteMarshalingStringMap) UnmarshalJSON

func (sm *OverwriteMarshalingStringMap) UnmarshalJSON(val []byte) error

func (*OverwriteMarshalingStringMap) UnmarshalYAML

func (sm *OverwriteMarshalingStringMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type RateLimit

type RateLimit struct {
	Limit rate.Limit
	Burst int
}

RateLimit is a colocated limit & burst config. It largely exists to eliminate accidental misconfigurations due to race conditions when requesting the limit & burst config sequentially, between which the Limits configuration may have updated.

type StreamRetention

type StreamRetention struct {
	Period   model.Duration    `yaml:"period" json:"period" doc:"description:Retention period applied to the log lines matching the selector."`
	Priority int               `yaml:"priority" json:"priority" doc:"description:The larger the value, the higher the priority."`
	Selector string            `yaml:"selector" json:"selector" doc:"description:Stream selector expression."`
	Matchers []*labels.Matcher `yaml:"-" json:"-"` // populated during validation.
}

type TenantLimits

type TenantLimits interface {
	// TenantLimits is a function that returns limits for given tenant, or
	// nil, if there are no tenant-specific limits.
	TenantLimits(userID string) *Limits
	// AllByUserID gets a mapping of all tenant IDs and limits for that user
	AllByUserID() map[string]*Limits
}

Jump to

Keyboard shortcuts

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