validation

package
v0.0.0-...-e3e1202 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSeriesPerMetricFlag                   = "ingester.max-global-series-per-metric"
	MaxMetadataPerMetricFlag                 = "ingester.max-global-metadata-per-metric"
	MaxSeriesPerUserFlag                     = "ingester.max-global-series-per-user"
	MaxMetadataPerUserFlag                   = "ingester.max-global-metadata-per-user"
	MaxChunksPerQueryFlag                    = "querier.max-fetched-chunks-per-query"
	MaxChunkBytesPerQueryFlag                = "querier.max-fetched-chunk-bytes-per-query"
	MaxSeriesPerQueryFlag                    = "querier.max-fetched-series-per-query"
	MaxEstimatedChunksPerQueryMultiplierFlag = "querier.max-estimated-fetched-chunks-per-query-multiplier"
	MaxLabelNamesPerSeriesFlag               = "validation.max-label-names-per-series"
	MaxLabelNameLengthFlag                   = "validation.max-length-label-name"
	MaxLabelValueLengthFlag                  = "validation.max-length-label-value"
	MaxMetadataLengthFlag                    = "validation.max-metadata-length"

	ReduceNativeHistogramOverMaxBucketsFlag = "validation.reduce-native-histogram-over-max-buckets"
	CreationGracePeriodFlag                 = "validation.create-grace-period"
	MaxPartialQueryLengthFlag               = "querier.max-partial-query-length"
	MaxTotalQueryLengthFlag                 = "query-frontend.max-total-query-length"
	MaxQueryExpressionSizeBytesFlag         = "query-frontend.max-query-expression-size-bytes"
	RequestRateFlag                         = "distributor.request-rate-limit"
	RequestBurstSizeFlag                    = "distributor.request-burst-size"
	IngestionRateFlag                       = "distributor.ingestion-rate-limit"
	IngestionBurstSizeFlag                  = "distributor.ingestion-burst-size"
	IngestionBurstFactorFlag                = "distributor.ingestion-burst-factor"
	HATrackerMaxClustersFlag                = "distributor.ha-tracker.max-clusters"

	QueryIngestersWithinFlag = "querier.query-ingesters-within"

	// MinCompactorPartialBlockDeletionDelay is the minimum partial blocks deletion delay that can be configured in Mimir.
	MinCompactorPartialBlockDeletionDelay = 4 * time.Hour
)

Variables

This section is empty.

Functions

func AllTrueBooleansPerTenant

func AllTrueBooleansPerTenant(tenantIDs []string, f func(string) bool) bool

AllTrueBooleansPerTenant returns true only if limit func is true for all given tenants

func DiscardedExemplarsCounter

func DiscardedExemplarsCounter(reg prometheus.Registerer, reason string) *prometheus.CounterVec

DiscardedExemplarsCounter creates per-user counter vector for exemplars discarded for a given reason.

func DiscardedMetadataCounter

func DiscardedMetadataCounter(reg prometheus.Registerer, reason string) *prometheus.CounterVec

DiscardedMetadataCounter creates per-user counter vector for metadata discarded for a given reason.

func DiscardedRequestsCounter

func DiscardedRequestsCounter(reg prometheus.Registerer, reason string) *prometheus.CounterVec

DiscardedRequestsCounter creates per-user counter vector for requests discarded for a given reason.

func DiscardedSamplesCounter

func DiscardedSamplesCounter(reg prometheus.Registerer, reason string) *prometheus.CounterVec

DiscardedSamplesCounter creates per-user counter vector for samples discarded for a given reason.

func GroupLabel

func GroupLabel(o *Overrides, userID string, timeseries []mimirpb.PreallocTimeseries) string

GroupLabel obtains the first non-empty group label from the first timeseries in the list of incoming timeseries.

func IsLimitError

func IsLimitError(err error) bool

func LargestPositiveNonZeroDurationPerTenant

func LargestPositiveNonZeroDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration

LargestPositiveNonZeroDurationPerTenant is returning the maximum positive and non-zero value of the supplied limit function for all given tenants. In many limits a value of 0 means unlimited so the method will return 0 only if all inputs have a limit of 0 or an empty tenant list is given.

func MaxDurationPerTenant

func MaxDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration

MaxDurationPerTenant is returning the maximum duration per tenant. Without tenants given it will return a time.Duration(0).

func MinDurationPerTenant

func MinDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration

MinDurationPerTenant is returning the minimum duration per tenant. Without tenants given it will return a time.Duration(0).

func MustRegisterExtension

func MustRegisterExtension[E interface{ Default() E }](name string) func(*Limits) E

MustRegisterExtension registers the extensions type with given name and returns a function to get the extensions value from a *Limits instance.

The provided name will be used as YAML/JSON key to decode the extensions.

The returned getter will return the result of E.Default() if *Limits is nil.

This method is not thread safe and should be called only during package initialization. Registering same name twice, or registering a name that is already a *Limits JSON or YAML key will cause a panic.

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.

func SmallestPositiveIntPerTenant

func SmallestPositiveIntPerTenant(tenantIDs []string, f func(string) int) int

SmallestPositiveIntPerTenant is returning the minimal positive value of the supplied limit function for all given tenants.

func SmallestPositiveNonZeroDurationPerTenant

func SmallestPositiveNonZeroDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration

SmallestPositiveNonZeroDurationPerTenant is returning the minimal positive and non-zero value of the supplied limit function for all given tenants. In many limits a value of 0 means unlimited so the method will return 0 only if all inputs have a limit of 0 or an empty tenant list is given.

func SmallestPositiveNonZeroIntPerTenant

func SmallestPositiveNonZeroIntPerTenant(tenantIDs []string, f func(string) int) int

SmallestPositiveNonZeroIntPerTenant is returning the minimal positive and non-zero value of the supplied limit function for all given tenants. In many limits a value of 0 means unlimited so the method will return 0 only if all inputs have a limit of 0 or an empty tenant list is given.

func UserLimitsHandler

func UserLimitsHandler(defaultLimits Limits, tenantLimits TenantLimits) http.HandlerFunc

UserLimitsHandler handles user limits.

Types

type BlockedQuery

type BlockedQuery struct {
	Pattern string `yaml:"pattern"`
	Regex   bool   `yaml:"regex"`
}

type LimitError

type LimitError interface {
	error
	// contains filtered or unexported methods
}

LimitError is a marker interface for the errors that do not comply with the specified limits.

func NewLimitError

func NewLimitError(msg string) LimitError

type Limits

type Limits struct {
	// Distributor enforced limits.
	RequestRate                                 float64             `yaml:"request_rate" json:"request_rate"`
	RequestBurstSize                            int                 `yaml:"request_burst_size" json:"request_burst_size"`
	IngestionRate                               float64             `yaml:"ingestion_rate" json:"ingestion_rate"`
	IngestionBurstSize                          int                 `yaml:"ingestion_burst_size" json:"ingestion_burst_size"`
	IngestionBurstFactor                        float64             `yaml:"ingestion_burst_factor" json:"ingestion_burst_factor" category:"experimental"`
	AcceptHASamples                             bool                `yaml:"accept_ha_samples" json:"accept_ha_samples"`
	HAClusterLabel                              string              `yaml:"ha_cluster_label" json:"ha_cluster_label"`
	HAReplicaLabel                              string              `yaml:"ha_replica_label" json:"ha_replica_label"`
	HAMaxClusters                               int                 `yaml:"ha_max_clusters" json:"ha_max_clusters"`
	DropLabels                                  flagext.StringSlice `yaml:"drop_labels" json:"drop_labels" category:"advanced"`
	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"`
	MaxMetadataLength                           int                 `yaml:"max_metadata_length" json:"max_metadata_length"`
	MaxNativeHistogramBuckets                   int                 `yaml:"max_native_histogram_buckets" json:"max_native_histogram_buckets"`
	MaxExemplarsPerSeriesPerRequest             int                 `yaml:"max_exemplars_per_series_per_request" json:"max_exemplars_per_series_per_request" category:"experimental"`
	ReduceNativeHistogramOverMaxBuckets         bool                `yaml:"reduce_native_histogram_over_max_buckets" json:"reduce_native_histogram_over_max_buckets"`
	CreationGracePeriod                         model.Duration      `yaml:"creation_grace_period" json:"creation_grace_period" category:"advanced"`
	EnforceMetadataMetricName                   bool                `yaml:"enforce_metadata_metric_name" json:"enforce_metadata_metric_name" category:"advanced"`
	IngestionTenantShardSize                    int                 `yaml:"ingestion_tenant_shard_size" json:"ingestion_tenant_shard_size"`
	MetricRelabelConfigs                        []*relabel.Config   `` /* 405-byte string literal not displayed */
	MetricRelabelingEnabled                     bool                `yaml:"metric_relabeling_enabled" json:"metric_relabeling_enabled" category:"experimental"`
	ServiceOverloadStatusCodeOnRateLimitEnabled bool                `` /* 139-byte string literal not displayed */
	// Ingester enforced limits.
	// Series
	MaxGlobalSeriesPerUser   int `yaml:"max_global_series_per_user" json:"max_global_series_per_user"`
	MaxGlobalSeriesPerMetric int `yaml:"max_global_series_per_metric" json:"max_global_series_per_metric"`
	// Metadata
	MaxGlobalMetricsWithMetadataPerUser int `yaml:"max_global_metadata_per_user" json:"max_global_metadata_per_user"`
	MaxGlobalMetadataPerMetric          int `yaml:"max_global_metadata_per_metric" json:"max_global_metadata_per_metric"`
	// Exemplars
	MaxGlobalExemplarsPerUser int `yaml:"max_global_exemplars_per_user" json:"max_global_exemplars_per_user" category:"experimental"`
	// Native histograms
	NativeHistogramsIngestionEnabled bool `yaml:"native_histograms_ingestion_enabled" json:"native_histograms_ingestion_enabled" category:"experimental"`
	// Active series custom trackers
	ActiveSeriesCustomTrackersConfig activeseries.CustomTrackersConfig `` /* 400-byte string literal not displayed */
	// Max allowed time window for out-of-order samples.
	OutOfOrderTimeWindow                 model.Duration `yaml:"out_of_order_time_window" json:"out_of_order_time_window" category:"experimental"`
	OutOfOrderBlocksExternalLabelEnabled bool           `yaml:"out_of_order_blocks_external_label_enabled" json:"out_of_order_blocks_external_label_enabled" category:"experimental"`

	// User defined label to give the option of subdividing specific metrics by another label
	SeparateMetricsGroupLabel string `yaml:"separate_metrics_group_label" json:"separate_metrics_group_label" category:"experimental"`

	// Querier enforced limits.
	MaxChunksPerQuery                    int            `yaml:"max_fetched_chunks_per_query" json:"max_fetched_chunks_per_query"`
	MaxEstimatedChunksPerQueryMultiplier float64        `` /* 137-byte string literal not displayed */
	MaxFetchedSeriesPerQuery             int            `yaml:"max_fetched_series_per_query" json:"max_fetched_series_per_query"`
	MaxFetchedChunkBytesPerQuery         int            `yaml:"max_fetched_chunk_bytes_per_query" json:"max_fetched_chunk_bytes_per_query"`
	MaxQueryLookback                     model.Duration `yaml:"max_query_lookback" json:"max_query_lookback"`
	MaxPartialQueryLength                model.Duration `yaml:"max_partial_query_length" json:"max_partial_query_length"`
	MaxQueryParallelism                  int            `yaml:"max_query_parallelism" json:"max_query_parallelism"`
	MaxLabelsQueryLength                 model.Duration `yaml:"max_labels_query_length" json:"max_labels_query_length"`
	MaxCacheFreshness                    model.Duration `yaml:"max_cache_freshness" json:"max_cache_freshness" category:"advanced"`
	MaxQueriersPerTenant                 int            `yaml:"max_queriers_per_tenant" json:"max_queriers_per_tenant"`
	QueryShardingTotalShards             int            `yaml:"query_sharding_total_shards" json:"query_sharding_total_shards"`
	QueryShardingMaxShardedQueries       int            `yaml:"query_sharding_max_sharded_queries" json:"query_sharding_max_sharded_queries"`
	QueryShardingMaxRegexpSizeBytes      int            `yaml:"query_sharding_max_regexp_size_bytes" json:"query_sharding_max_regexp_size_bytes"`
	SplitInstantQueriesByInterval        model.Duration `yaml:"split_instant_queries_by_interval" json:"split_instant_queries_by_interval" category:"experimental"`
	QueryIngestersWithin                 model.Duration `yaml:"query_ingesters_within" json:"query_ingesters_within" category:"advanced"`

	// Query-frontend limits.
	MaxTotalQueryLength                    model.Duration  `yaml:"max_total_query_length" json:"max_total_query_length"`
	ResultsCacheTTL                        model.Duration  `yaml:"results_cache_ttl" json:"results_cache_ttl"`
	ResultsCacheTTLForOutOfOrderTimeWindow model.Duration  `yaml:"results_cache_ttl_for_out_of_order_time_window" json:"results_cache_ttl_for_out_of_order_time_window"`
	ResultsCacheTTLForCardinalityQuery     model.Duration  `yaml:"results_cache_ttl_for_cardinality_query" json:"results_cache_ttl_for_cardinality_query"`
	ResultsCacheTTLForLabelsQuery          model.Duration  `yaml:"results_cache_ttl_for_labels_query" json:"results_cache_ttl_for_labels_query"`
	ResultsCacheForUnalignedQueryEnabled   bool            `yaml:"cache_unaligned_requests" json:"cache_unaligned_requests" category:"advanced"`
	MaxQueryExpressionSizeBytes            int             `yaml:"max_query_expression_size_bytes" json:"max_query_expression_size_bytes"`
	BlockedQueries                         []*BlockedQuery `` /* 139-byte string literal not displayed */
	AlignQueriesWithStep                   bool            `yaml:"align_queries_with_step" json:"align_queries_with_step"`

	// Cardinality
	CardinalityAnalysisEnabled                    bool `yaml:"cardinality_analysis_enabled" json:"cardinality_analysis_enabled"`
	LabelNamesAndValuesResultsMaxSizeBytes        int  `yaml:"label_names_and_values_results_max_size_bytes" json:"label_names_and_values_results_max_size_bytes"`
	LabelValuesMaxCardinalityLabelNamesPerRequest int  `yaml:"label_values_max_cardinality_label_names_per_request" json:"label_values_max_cardinality_label_names_per_request"`
	ActiveSeriesResultsMaxSizeBytes               int  `yaml:"active_series_results_max_size_bytes" json:"active_series_results_max_size_bytes" category:"experimental"`

	// Ruler defaults and limits.
	RulerEvaluationDelay                 model.Duration `yaml:"ruler_evaluation_delay_duration" json:"ruler_evaluation_delay_duration"`
	RulerTenantShardSize                 int            `yaml:"ruler_tenant_shard_size" json:"ruler_tenant_shard_size"`
	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"`
	RulerRecordingRulesEvaluationEnabled bool           `yaml:"ruler_recording_rules_evaluation_enabled" json:"ruler_recording_rules_evaluation_enabled" category:"experimental"`
	RulerAlertingRulesEvaluationEnabled  bool           `yaml:"ruler_alerting_rules_evaluation_enabled" json:"ruler_alerting_rules_evaluation_enabled" category:"experimental"`
	RulerSyncRulesOnChangesEnabled       bool           `yaml:"ruler_sync_rules_on_changes_enabled" json:"ruler_sync_rules_on_changes_enabled" category:"advanced"`

	// Store-gateway.
	StoreGatewayTenantShardSize int `yaml:"store_gateway_tenant_shard_size" json:"store_gateway_tenant_shard_size"`

	// Compactor.
	CompactorBlocksRetentionPeriod        model.Duration `yaml:"compactor_blocks_retention_period" json:"compactor_blocks_retention_period"`
	CompactorSplitAndMergeShards          int            `yaml:"compactor_split_and_merge_shards" json:"compactor_split_and_merge_shards"`
	CompactorSplitGroups                  int            `yaml:"compactor_split_groups" json:"compactor_split_groups"`
	CompactorTenantShardSize              int            `yaml:"compactor_tenant_shard_size" json:"compactor_tenant_shard_size"`
	CompactorPartialBlockDeletionDelay    model.Duration `yaml:"compactor_partial_block_deletion_delay" json:"compactor_partial_block_deletion_delay"`
	CompactorBlockUploadEnabled           bool           `yaml:"compactor_block_upload_enabled" json:"compactor_block_upload_enabled"`
	CompactorBlockUploadValidationEnabled bool           `yaml:"compactor_block_upload_validation_enabled" json:"compactor_block_upload_validation_enabled"`
	CompactorBlockUploadVerifyChunks      bool           `yaml:"compactor_block_upload_verify_chunks" json:"compactor_block_upload_verify_chunks"`
	CompactorBlockUploadMaxBlockSizeBytes int64          `yaml:"compactor_block_upload_max_block_size_bytes" json:"compactor_block_upload_max_block_size_bytes" category:"advanced"`

	// This config doesn't have a CLI flag registered here because they're registered in
	// their own original config struct.
	S3SSEType                 string `` /* 221-byte string literal not displayed */
	S3SSEKMSKeyID             string `` /* 156-byte string literal not displayed */
	S3SSEKMSEncryptionContext string `` /* 284-byte string literal not displayed */

	// Alertmanager.
	AlertmanagerReceiversBlockCIDRNetworks     flagext.CIDRSliceCSV `yaml:"alertmanager_receivers_firewall_block_cidr_networks" json:"alertmanager_receivers_firewall_block_cidr_networks"`
	AlertmanagerReceiversBlockPrivateAddresses bool                 `yaml:"alertmanager_receivers_firewall_block_private_addresses" json:"alertmanager_receivers_firewall_block_private_addresses"`

	NotificationRateLimit               float64                  `yaml:"alertmanager_notification_rate_limit" json:"alertmanager_notification_rate_limit"`
	NotificationRateLimitPerIntegration NotificationRateLimitMap `yaml:"alertmanager_notification_rate_limit_per_integration" json:"alertmanager_notification_rate_limit_per_integration"`

	AlertmanagerMaxConfigSizeBytes             int `yaml:"alertmanager_max_config_size_bytes" json:"alertmanager_max_config_size_bytes"`
	AlertmanagerMaxTemplatesCount              int `yaml:"alertmanager_max_templates_count" json:"alertmanager_max_templates_count"`
	AlertmanagerMaxTemplateSizeBytes           int `yaml:"alertmanager_max_template_size_bytes" json:"alertmanager_max_template_size_bytes"`
	AlertmanagerMaxDispatcherAggregationGroups int `yaml:"alertmanager_max_dispatcher_aggregation_groups" json:"alertmanager_max_dispatcher_aggregation_groups"`
	AlertmanagerMaxAlertsCount                 int `yaml:"alertmanager_max_alerts_count" json:"alertmanager_max_alerts_count"`
	AlertmanagerMaxAlertsSizeBytes             int `yaml:"alertmanager_max_alerts_size_bytes" json:"alertmanager_max_alerts_size_bytes"`

	// OpenTelemetry
	OTelMetricSuffixesEnabled bool `yaml:"otel_metric_suffixes_enabled" json:"otel_metric_suffixes_enabled" category:"advanced"`

	// Ingest storage.
	IngestStorageReadConsistency       string `yaml:"ingest_storage_read_consistency" json:"ingest_storage_read_consistency" category:"experimental" doc:"hidden"`
	IngestionPartitionsTenantShardSize int    `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

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 MockDefaultLimits

func MockDefaultLimits() *Limits

func (*Limits) MarshalJSON

func (l *Limits) MarshalJSON() ([]byte, error)

func (*Limits) MarshalYAML

func (l *Limits) MarshalYAML() (interface{}, error)

func (*Limits) RegisterExtensionsDefaults

func (l *Limits) RegisterExtensionsDefaults()

RegisterExtensionsDefaults registers the default values for extensions into l. This is especially handy for those downstream projects that wish to have control over the exact moment in which the registration happens (e.g. during service dependency initialization).

func (*Limits) RegisterFlags

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

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

func (*Limits) UnmarshalJSON

func (l *Limits) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Limits) UnmarshalYAML

func (l *Limits) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type NotificationRateLimitMap

type NotificationRateLimitMap map[string]float64

func (NotificationRateLimitMap) MarshalYAML

func (m NotificationRateLimitMap) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (NotificationRateLimitMap) Set

Set implements flag.Value

func (NotificationRateLimitMap) String

func (m NotificationRateLimitMap) String() string

String implements flag.Value

func (NotificationRateLimitMap) UnmarshalYAML

func (m NotificationRateLimitMap) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

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 MockDefaultOverrides

func MockDefaultOverrides() *Overrides

func MockOverrides

func MockOverrides(customize func(defaults *Limits, tenantLimits map[string]*Limits)) *Overrides

func NewOverrides

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

NewOverrides makes a new Overrides.

func (*Overrides) AcceptHASamples

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

AcceptHASamples returns whether the distributor should track and accept samples from HA replicas for this user.

func (*Overrides) ActiveSeriesCustomTrackersConfig

func (o *Overrides) ActiveSeriesCustomTrackersConfig(userID string) activeseries.CustomTrackersConfig

func (*Overrides) ActiveSeriesResultsMaxSizeBytes

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

func (*Overrides) AlertmanagerMaxAlertsCount

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

func (*Overrides) AlertmanagerMaxAlertsSizeBytes

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

func (*Overrides) AlertmanagerMaxConfigSize

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

func (*Overrides) AlertmanagerMaxDispatcherAggregationGroups

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

func (*Overrides) AlertmanagerMaxTemplateSize

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

func (*Overrides) AlertmanagerMaxTemplatesCount

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

func (*Overrides) AlertmanagerReceiversBlockCIDRNetworks

func (o *Overrides) AlertmanagerReceiversBlockCIDRNetworks(user string) []flagext.CIDR

AlertmanagerReceiversBlockCIDRNetworks returns the list of network CIDRs that should be blocked in the Alertmanager receivers for the given user.

func (*Overrides) AlertmanagerReceiversBlockPrivateAddresses

func (o *Overrides) AlertmanagerReceiversBlockPrivateAddresses(user string) bool

AlertmanagerReceiversBlockPrivateAddresses returns true if private addresses should be blocked in the Alertmanager receivers for the given user.

func (*Overrides) AlignQueriesWithStep

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

func (*Overrides) BlockedQueries

func (o *Overrides) BlockedQueries(userID string) []*BlockedQuery

BlockedQueries returns the blocked queries.

func (*Overrides) CardinalityAnalysisEnabled

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

func (*Overrides) CompactorBlockUploadEnabled

func (o *Overrides) CompactorBlockUploadEnabled(tenantID string) bool

CompactorBlockUploadEnabled returns whether block upload is enabled for a certain tenant.

func (*Overrides) CompactorBlockUploadMaxBlockSizeBytes

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

CompactorBlockUploadMaxBlockSizeBytes returns the maximum size in bytes of a block that is allowed to be uploaded or validated for a given user.

func (*Overrides) CompactorBlockUploadValidationEnabled

func (o *Overrides) CompactorBlockUploadValidationEnabled(tenantID string) bool

CompactorBlockUploadValidationEnabled returns whether block upload validation is enabled for a certain tenant.

func (*Overrides) CompactorBlockUploadVerifyChunks

func (o *Overrides) CompactorBlockUploadVerifyChunks(tenantID string) bool

CompactorBlockUploadVerifyChunks returns whether compaction chunk verification is enabled for a certain tenant.

func (*Overrides) CompactorBlocksRetentionPeriod

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

CompactorBlocksRetentionPeriod returns the retention period for a given user.

func (*Overrides) CompactorPartialBlockDeletionDelay

func (o *Overrides) CompactorPartialBlockDeletionDelay(userID string) (delay time.Duration, valid bool)

CompactorPartialBlockDeletionDelay returns the partial block deletion delay time period for a given user, and whether the configured value was valid. If the value wasn't valid, the returned delay is the default one and the caller is responsible to warn the Mimir operator about it.

func (*Overrides) CompactorSplitAndMergeShards

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

CompactorSplitAndMergeShards returns the number of shards to use when splitting blocks.

func (*Overrides) CompactorSplitGroups

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

CompactorSplitGroups returns the number of groups that blocks for splitting should be grouped into.

func (*Overrides) CompactorTenantShardSize

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

CompactorTenantShardSize returns number of compactors that this user can use. 0 = all compactors.

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

func (o *Overrides) DropLabels(userID string) flagext.StringSlice

DropLabels returns the list of labels to be dropped when ingesting HA samples for the user.

func (*Overrides) EnforceMetadataMetricName

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

EnforceMetadataMetricName whether to enforce the presence of a metric name on metadata.

func (*Overrides) EvaluationDelay

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

EvaluationDelay returns the rules evaluation delay for a given user.

func (*Overrides) HAClusterLabel

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

HAClusterLabel returns the cluster label to look for when deciding whether to accept a sample from a Prometheus HA replica.

func (*Overrides) HAReplicaLabel

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

HAReplicaLabel returns the replica label to look for when deciding whether to accept a sample from a Prometheus HA replica.

func (*Overrides) IngestStorageReadConsistency

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

func (*Overrides) IngestionBurstFactor

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

func (*Overrides) IngestionBurstSize

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

IngestionBurstSize returns the burst size for ingestion rate.

func (*Overrides) IngestionPartitionsTenantShardSize

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

func (*Overrides) IngestionRate

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

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

func (*Overrides) IngestionTenantShardSize

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

IngestionTenantShardSize returns the ingesters shard size for a given user.

func (*Overrides) LabelNamesAndValuesResultsMaxSizeBytes

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

LabelNamesAndValuesResultsMaxSizeBytes returns the maximum size in bytes of distinct label names and values

func (*Overrides) LabelValuesMaxCardinalityLabelNamesPerRequest

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

LabelValuesMaxCardinalityLabelNamesPerRequest returns the maximum number of label names per cardinality request.

func (*Overrides) MaxCacheFreshness

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

MaxCacheFreshness returns the period after which results are cacheable, to prevent caching of very recent results.

func (*Overrides) MaxChunksPerQuery

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

func (*Overrides) MaxEstimatedChunksPerQuery

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

func (*Overrides) MaxExemplarsPerSeriesPerRequest

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

func (*Overrides) MaxFetchedChunkBytesPerQuery

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

MaxFetchedChunkBytesPerQuery returns the maximum number of bytes for chunks allowed per query when fetching chunks from ingesters and blocks storage.

func (*Overrides) MaxFetchedSeriesPerQuery

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

MaxFetchedSeriesPerQuery returns the maximum number of series allowed per query when fetching chunks from ingesters and blocks storage.

func (*Overrides) MaxGlobalExemplarsPerUser

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

MaxGlobalExemplarsPerUser returns the maximum number of exemplars held in memory across the cluster.

func (*Overrides) MaxGlobalMetadataPerMetric

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

MaxGlobalMetadataPerMetric returns the maximum number of metadata allowed per metric across the cluster.

func (*Overrides) MaxGlobalMetricsWithMetadataPerUser

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

MaxGlobalMetricsWithMetadataPerUser returns the maximum number of metrics with metadata a user is allowed to store across the cluster.

func (*Overrides) MaxGlobalSeriesPerMetric

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

MaxGlobalSeriesPerMetric returns the maximum number of series allowed per metric across the cluster.

func (*Overrides) MaxGlobalSeriesPerUser

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

MaxGlobalSeriesPerUser returns the maximum number of series a user is allowed to store across the cluster.

func (*Overrides) MaxHAClusters

func (o *Overrides) MaxHAClusters(user string) int

MaxHAClusters returns maximum number of clusters that HA tracker will track for a user.

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

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

MaxLabelsQueryLength returns the limit of the length (in time) of a label names or values request.

func (*Overrides) MaxMetadataLength

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

MaxMetadataLength returns maximum length metadata can be. Metadata refers to the Metric Name, HELP and UNIT.

func (*Overrides) MaxNativeHistogramBuckets

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

MaxNativeHistogramBuckets returns the maximum number of buckets per native histogram sample.

func (*Overrides) MaxPartialQueryLength

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

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

func (*Overrides) MaxQueriersPerUser

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

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

func (*Overrides) MaxQueryExpressionSizeBytes

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

MaxQueryExpressionSizeBytes returns the limit of the raw query size, in bytes.

func (*Overrides) MaxQueryLookback

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

MaxQueryLookback returns the max lookback period of queries.

func (*Overrides) MaxQueryParallelism

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

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

func (*Overrides) MaxTotalQueryLength

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

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

func (*Overrides) MetricRelabelConfigs

func (o *Overrides) MetricRelabelConfigs(userID string) []*relabel.Config

MetricRelabelConfigs returns the metric relabel configs for a given user.

func (*Overrides) MetricRelabelingEnabled

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

func (*Overrides) NativeHistogramsIngestionEnabled

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

NativeHistogramsIngestionEnabled returns whether to ingest native histograms in the ingester

func (*Overrides) NotificationBurstSize

func (o *Overrides) NotificationBurstSize(user string, integration string) int

func (*Overrides) NotificationRateLimit

func (o *Overrides) NotificationRateLimit(user string, integration string) rate.Limit

func (*Overrides) OTelMetricSuffixesEnabled

func (o *Overrides) OTelMetricSuffixesEnabled(tenantID string) bool

func (*Overrides) OutOfOrderBlocksExternalLabelEnabled

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

OutOfOrderBlocksExternalLabelEnabled returns if the shipper is flagging out-of-order blocks with an external label.

func (*Overrides) OutOfOrderTimeWindow

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

OutOfOrderTimeWindow returns the out-of-order time window for the user.

func (*Overrides) QueryIngestersWithin

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

QueryIngestersWithin returns the maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.

func (*Overrides) QueryShardingMaxRegexpSizeBytes

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

QueryShardingMaxRegexpSizeBytes returns the limit to the max number of bytes allowed for a regexp matcher in a shardable query. If a query contains a regexp matcher longer than this limit, the query will not be sharded. 0 to disable limit.

func (*Overrides) QueryShardingMaxShardedQueries

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

QueryShardingMaxShardedQueries returns the max number of sharded queries that can be run for a given received query. 0 to disable limit.

func (*Overrides) QueryShardingTotalShards

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

QueryShardingTotalShards returns the total amount of shards to use when splitting queries via querysharding the frontend. When a query is shardable, each shards will be processed in parallel.

func (*Overrides) ReduceNativeHistogramOverMaxBuckets

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

ReduceNativeHistogramOverMaxBuckets returns whether to reduce or reject native histogram samples with more buckets than the configured limit.

func (*Overrides) RequestBurstSize

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

RequestBurstSize returns the burst size for request rate.

func (*Overrides) RequestRate

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

RequestRate returns the limit on request rate (requests per second).

func (*Overrides) ResultsCacheForUnalignedQueryEnabled

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

func (*Overrides) ResultsCacheTTL

func (o *Overrides) ResultsCacheTTL(user string) time.Duration

func (*Overrides) ResultsCacheTTLForCardinalityQuery

func (o *Overrides) ResultsCacheTTLForCardinalityQuery(user string) time.Duration

func (*Overrides) ResultsCacheTTLForLabelsQuery

func (o *Overrides) ResultsCacheTTLForLabelsQuery(user string) time.Duration

func (*Overrides) ResultsCacheTTLForOutOfOrderTimeWindow

func (o *Overrides) ResultsCacheTTLForOutOfOrderTimeWindow(user string) time.Duration

func (*Overrides) RulerAlertingRulesEvaluationEnabled

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

RulerAlertingRulesEvaluationEnabled returns whether the alerting rules evaluation is enabled 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) RulerRecordingRulesEvaluationEnabled

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

RulerRecordingRulesEvaluationEnabled returns whether the recording rules evaluation is enabled for a given user.

func (*Overrides) RulerSyncRulesOnChangesEnabled

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

RulerSyncRulesOnChangesEnabled returns whether the ruler's event-based sync is enabled.

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

func (o *Overrides) S3SSEKMSEncryptionContext(user string) string

S3SSEKMSEncryptionContext returns the per-tenant S3 KMS-SSE encryption context.

func (*Overrides) S3SSEKMSKeyID

func (o *Overrides) S3SSEKMSKeyID(user string) string

S3SSEKMSKeyID returns the per-tenant S3 KMS-SSE key id.

func (*Overrides) S3SSEType

func (o *Overrides) S3SSEType(user string) string

S3SSEType returns the per-tenant S3 SSE type.

func (*Overrides) SeparateMetricsGroupLabel

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

SeparateMetricsGroupLabel returns the custom label used to separate specific metrics

func (*Overrides) ServiceOverloadStatusCodeOnRateLimitEnabled

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

ServiceOverloadStatusCodeOnRateLimitEnabled return whether the distributor uses status code 529 instead of 429 when the rate limit is exceeded.

func (*Overrides) SplitInstantQueriesByInterval

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

SplitInstantQueriesByInterval returns the split time interval to use when splitting an instant query via the query-frontend. 0 to disable limit.

func (*Overrides) StoreGatewayTenantShardSize

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

StoreGatewayTenantShardSize returns the store-gateway shard size for a given user.

type TenantLimits

type TenantLimits interface {
	// ByUserID gets limits specific to a particular tenant or nil if there are none
	ByUserID(userID string) *Limits

	// AllByUserID gets a mapping of all tenant IDs and limits for that user
	AllByUserID() map[string]*Limits
}

TenantLimits exposes per-tenant limit overrides to various resource usage limits

func NewMockTenantLimits

func NewMockTenantLimits(limits map[string]*Limits) TenantLimits

NewMockTenantLimits creates a new mockTenantLimits that returns per-tenant limits based on the given map

type UserLimitsResponse

type UserLimitsResponse struct {
	CompactorBlocksRetentionPeriod int64 `json:"compactor_blocks_retention_period_seconds"` // suffix with second to make it explicit the value is in seconds

	// Write path limits
	IngestionRate             float64 `json:"ingestion_rate"`
	IngestionBurstSize        int     `json:"ingestion_burst_size"`
	IngestionBurstFactor      float64 `json:"ingestion_burst_factor"`
	MaxGlobalSeriesPerUser    int     `json:"max_global_series_per_user"`
	MaxGlobalSeriesPerMetric  int     `json:"max_global_series_per_metric"`
	MaxGlobalExemplarsPerUser int     `json:"max_global_exemplars_per_user"`

	// Read path limits
	MaxChunksPerQuery            int `json:"max_fetched_chunks_per_query"`
	MaxFetchedSeriesPerQuery     int `json:"max_fetched_series_per_query"`
	MaxFetchedChunkBytesPerQuery int `json:"max_fetched_chunk_bytes_per_query"`

	// Ruler limits
	RulerMaxRulesPerRuleGroup   int `json:"ruler_max_rules_per_rule_group"`
	RulerMaxRuleGroupsPerTenant int `json:"ruler_max_rule_groups_per_tenant"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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