Documentation ¶
Index ¶
- Constants
- func MaxDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration
- func SetDefaultLimitsForYAMLUnmarshalling(defaults Limits)
- func SmallestPositiveIntPerTenant(tenantIDs []string, f func(string) int) int
- func SmallestPositiveNonZeroDurationPerTenant(tenantIDs []string, f func(string) time.Duration) time.Duration
- func SmallestPositiveNonZeroIntPerTenant(tenantIDs []string, f func(string) int) int
- type LimitError
- type Limits
- type NotificationRateLimitMap
- type Overrides
- func (o *Overrides) AcceptHASamples(userID string) bool
- func (o *Overrides) AlertmanagerMaxAlertsCount(userID string) int
- func (o *Overrides) AlertmanagerMaxAlertsSizeBytes(userID string) int
- func (o *Overrides) AlertmanagerMaxConfigSize(userID string) int
- func (o *Overrides) AlertmanagerMaxDispatcherAggregationGroups(userID string) int
- func (o *Overrides) AlertmanagerMaxTemplateSize(userID string) int
- func (o *Overrides) AlertmanagerMaxTemplatesCount(userID string) int
- func (o *Overrides) AlertmanagerReceiversBlockCIDRNetworks(user string) []flagext.CIDR
- func (o *Overrides) AlertmanagerReceiversBlockPrivateAddresses(user string) bool
- func (o *Overrides) CardinalityLimit(userID string) int
- func (o *Overrides) CompactorBlocksRetentionPeriod(userID string) time.Duration
- func (o *Overrides) CompactorTenantShardSize(userID string) int
- func (o *Overrides) CreationGracePeriod(userID string) time.Duration
- func (o *Overrides) DropLabels(userID string) flagext.StringSlice
- func (o *Overrides) EnforceMetadataMetricName(userID string) bool
- func (o *Overrides) EnforceMetricName(userID string) bool
- func (o *Overrides) EvaluationDelay(userID string) time.Duration
- func (o *Overrides) HAClusterLabel(userID string) string
- func (o *Overrides) HAReplicaLabel(userID string) string
- func (o *Overrides) IngestionBurstSize(userID string) int
- func (o *Overrides) IngestionRate(userID string) float64
- func (o *Overrides) IngestionRateStrategy() string
- func (o *Overrides) IngestionTenantShardSize(userID string) int
- func (o *Overrides) MaxCacheFreshness(userID string) time.Duration
- func (o *Overrides) MaxChunksPerQuery(userID string) int
- func (o *Overrides) MaxChunksPerQueryFromStore(userID string) int
- func (o *Overrides) MaxFetchedChunkBytesPerQuery(userID string) int
- func (o *Overrides) MaxFetchedSeriesPerQuery(userID string) int
- func (o *Overrides) MaxGlobalMetadataPerMetric(userID string) int
- func (o *Overrides) MaxGlobalMetricsWithMetadataPerUser(userID string) int
- func (o *Overrides) MaxGlobalSeriesPerMetric(userID string) int
- func (o *Overrides) MaxGlobalSeriesPerUser(userID string) int
- func (o *Overrides) MaxHAClusters(user string) int
- func (o *Overrides) MaxLabelNameLength(userID string) int
- func (o *Overrides) MaxLabelNamesPerSeries(userID string) int
- func (o *Overrides) MaxLabelValueLength(userID string) int
- func (o *Overrides) MaxLocalMetadataPerMetric(userID string) int
- func (o *Overrides) MaxLocalMetricsWithMetadataPerUser(userID string) int
- func (o *Overrides) MaxLocalSeriesPerMetric(userID string) int
- func (o *Overrides) MaxLocalSeriesPerUser(userID string) int
- func (o *Overrides) MaxMetadataLength(userID string) int
- func (o *Overrides) MaxQueriersPerUser(userID string) int
- func (o *Overrides) MaxQueryLength(userID string) time.Duration
- func (o *Overrides) MaxQueryLookback(userID string) time.Duration
- func (o *Overrides) MaxQueryParallelism(userID string) int
- func (o *Overrides) MaxSamplesPerQuery(userID string) int
- func (o *Overrides) MaxSeriesPerQuery(userID string) int
- func (o *Overrides) MetricRelabelConfigs(userID string) []*relabel.Config
- func (o *Overrides) MinChunkLength(userID string) int
- func (o *Overrides) NotificationBurstSize(user string, integration string) int
- func (o *Overrides) NotificationRateLimit(user string, integration string) rate.Limit
- func (o *Overrides) RejectOldSamples(userID string) bool
- func (o *Overrides) RejectOldSamplesMaxAge(userID string) time.Duration
- func (o *Overrides) RulerMaxRuleGroupsPerTenant(userID string) int
- func (o *Overrides) RulerMaxRulesPerRuleGroup(userID string) int
- func (o *Overrides) RulerTenantShardSize(userID string) int
- func (o *Overrides) S3SSEKMSEncryptionContext(user string) string
- func (o *Overrides) S3SSEKMSKeyID(user string) string
- func (o *Overrides) S3SSEType(user string) string
- func (o *Overrides) StoreGatewayTenantShardSize(userID string) int
- type TenantLimits
Constants ¶
const ( LocalIngestionRateStrategy = "local" GlobalIngestionRateStrategy = "global" )
Supported values for enum limits
const (
// ErrQueryTooLong is used in chunk store, querier and query frontend.
ErrQueryTooLong = "the query time range exceeds the limit (query length: %s, limit: %s)"
)
Variables ¶
This section is empty.
Functions ¶
func MaxDurationPerTenant ¶
MaxDurationPerTenant is returning the maximum duration per tenant. Without tenants given it will return a time.Duration(0).
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 ¶
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 unlimted so the method will return 0 only if all inputs have a limit of 0 or an empty tenant list is given.
func SmallestPositiveNonZeroIntPerTenant ¶
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 unlimted so the method will return 0 only if all inputs have a limit of 0 or an empty tenant list is given.
Types ¶
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. IngestionRate float64 `yaml:"ingestion_rate" json:"ingestion_rate"` IngestionRateStrategy string `yaml:"ingestion_rate_strategy" json:"ingestion_rate_strategy"` IngestionBurstSize int `yaml:"ingestion_burst_size" json:"ingestion_burst_size"` 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"` 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"` 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"` EnforceMetadataMetricName bool `yaml:"enforce_metadata_metric_name" json:"enforce_metadata_metric_name"` EnforceMetricName bool `yaml:"enforce_metric_name" json:"enforce_metric_name"` IngestionTenantShardSize int `yaml:"ingestion_tenant_shard_size" json:"ingestion_tenant_shard_size"` MetricRelabelConfigs []*relabel.Config `` /* 295-byte string literal not displayed */ // Ingester enforced limits. // Series MaxSeriesPerQuery int `yaml:"max_series_per_query" json:"max_series_per_query"` MaxSamplesPerQuery int `yaml:"max_samples_per_query" json:"max_samples_per_query"` MaxLocalSeriesPerUser int `yaml:"max_series_per_user" json:"max_series_per_user"` MaxLocalSeriesPerMetric int `yaml:"max_series_per_metric" json:"max_series_per_metric"` 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"` MinChunkLength int `yaml:"min_chunk_length" json:"min_chunk_length"` // Metadata MaxLocalMetricsWithMetadataPerUser int `yaml:"max_metadata_per_user" json:"max_metadata_per_user"` MaxLocalMetadataPerMetric int `yaml:"max_metadata_per_metric" json:"max_metadata_per_metric"` 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"` // Querier enforced limits. MaxChunksPerQueryFromStore int `yaml:"max_chunks_per_query" json:"max_chunks_per_query"` // TODO Remove in Cortex 1.12. MaxChunksPerQuery int `yaml:"max_fetched_chunks_per_query" json:"max_fetched_chunks_per_query"` 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"` MaxQueryLength model.Duration `yaml:"max_query_length" json:"max_query_length"` MaxQueryParallelism int `yaml:"max_query_parallelism" json:"max_query_parallelism"` CardinalityLimit int `yaml:"cardinality_limit" json:"cardinality_limit"` MaxCacheFreshness model.Duration `yaml:"max_cache_freshness" json:"max_cache_freshness"` MaxQueriersPerTenant int `yaml:"max_queriers_per_tenant" json:"max_queriers_per_tenant"` // 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"` // 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"` CompactorTenantShardSize int `yaml:"compactor_tenant_shard_size" json:"compactor_tenant_shard_size"` // 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"` }
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 ¶
RegisterFlags adds the flags required to config this to the given FlagSet
func (*Limits) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Limits) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type NotificationRateLimitMap ¶
func (NotificationRateLimitMap) MarshalYAML ¶
func (m NotificationRateLimitMap) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler.
func (NotificationRateLimitMap) Set ¶
func (m NotificationRateLimitMap) Set(s string) error
Set implements flag.Value
func (NotificationRateLimitMap) String ¶
func (m NotificationRateLimitMap) String() string
String implements flag.Value
func (NotificationRateLimitMap) UnmarshalYAML ¶
func (m NotificationRateLimitMap) UnmarshalYAML(unmarshal func(interface{}) error) 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 NewOverrides ¶
func NewOverrides(defaults Limits, tenantLimits TenantLimits) (*Overrides, error)
NewOverrides makes a new Overrides.
func (*Overrides) AcceptHASamples ¶
AcceptHASamples returns whether the distributor should track and accept samples from HA replicas for this user.
func (*Overrides) AlertmanagerMaxAlertsCount ¶
func (*Overrides) AlertmanagerMaxAlertsSizeBytes ¶
func (*Overrides) AlertmanagerMaxConfigSize ¶
func (*Overrides) AlertmanagerMaxDispatcherAggregationGroups ¶
func (*Overrides) AlertmanagerMaxTemplateSize ¶
func (*Overrides) AlertmanagerMaxTemplatesCount ¶
func (*Overrides) AlertmanagerReceiversBlockCIDRNetworks ¶
AlertmanagerReceiversBlockCIDRNetworks returns the list of network CIDRs that should be blocked in the Alertmanager receivers for the given user.
func (*Overrides) AlertmanagerReceiversBlockPrivateAddresses ¶
AlertmanagerReceiversBlockPrivateAddresses returns true if private addresses should be blocked in the Alertmanager receivers for the given user.
func (*Overrides) CardinalityLimit ¶
CardinalityLimit returns the maximum number of timeseries allowed in a query.
func (*Overrides) CompactorBlocksRetentionPeriod ¶
CompactorBlocksRetentionPeriod returns the retention period for a given user.
func (*Overrides) CompactorTenantShardSize ¶
CompactorTenantShardSize returns shard size (number of rulers) used by this tenant when using shuffle-sharding strategy.
func (*Overrides) CreationGracePeriod ¶
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 ¶
EnforceMetadataMetricName whether to enforce the presence of a metric name on metadata.
func (*Overrides) EnforceMetricName ¶
EnforceMetricName whether to enforce the presence of a metric name.
func (*Overrides) EvaluationDelay ¶
EvaluationDelay returns the rules evaluation delay for a given user.
func (*Overrides) HAClusterLabel ¶
HAClusterLabel returns the cluster label to look for when deciding whether to accept a sample from a Prometheus HA replica.
func (*Overrides) HAReplicaLabel ¶
HAReplicaLabel returns the replica label to look for when deciding whether to accept a sample from a Prometheus HA replica.
func (*Overrides) IngestionBurstSize ¶
IngestionBurstSize returns the burst size for ingestion rate.
func (*Overrides) IngestionRate ¶
IngestionRate returns the limit on ingester rate (samples per second).
func (*Overrides) IngestionRateStrategy ¶
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) IngestionTenantShardSize ¶
IngestionTenantShardSize returns the ingesters shard size for a given user.
func (*Overrides) MaxCacheFreshness ¶
MaxCacheFreshness returns the period after which results are cacheable, to prevent caching of very recent results.
func (*Overrides) MaxChunksPerQuery ¶
func (*Overrides) MaxChunksPerQueryFromStore ¶
MaxChunksPerQueryFromStore returns the maximum number of chunks allowed per query when fetching chunks from the long-term storage.
func (*Overrides) MaxFetchedChunkBytesPerQuery ¶
MaxFetchedChunkBytesPerQuery returns the maximum number of bytes for chunks allowed per query when fetching chunks from ingesters and blocks storage.
func (*Overrides) MaxFetchedSeriesPerQuery ¶
MaxFetchedSeriesPerQuery returns the maximum number of series allowed per query when fetching chunks from ingesters and blocks storage.
func (*Overrides) MaxGlobalMetadataPerMetric ¶
MaxGlobalMetadataPerMetric returns the maximum number of metadata allowed per metric across the cluster.
func (*Overrides) MaxGlobalMetricsWithMetadataPerUser ¶
MaxGlobalMetricsWithMetadataPerUser returns the maximum number of metrics with metadata a user is allowed to store across the cluster.
func (*Overrides) MaxGlobalSeriesPerMetric ¶
MaxGlobalSeriesPerMetric returns the maximum number of series allowed per metric across the cluster.
func (*Overrides) MaxGlobalSeriesPerUser ¶
MaxGlobalSeriesPerUser returns the maximum number of series a user is allowed to store across the cluster.
func (*Overrides) MaxHAClusters ¶
MaxHAClusters returns maximum number of clusters that HA tracker will track for a user.
func (*Overrides) MaxLabelNameLength ¶
MaxLabelNameLength returns maximum length a label name can be.
func (*Overrides) MaxLabelNamesPerSeries ¶
MaxLabelNamesPerSeries returns maximum number of label/value pairs timeseries.
func (*Overrides) MaxLabelValueLength ¶
MaxLabelValueLength returns maximum length a label value can be. This also is the maximum length of a metric name.
func (*Overrides) MaxLocalMetadataPerMetric ¶
MaxLocalMetadataPerMetric returns the maximum number of metadata allowed per metric in a single ingester.
func (*Overrides) MaxLocalMetricsWithMetadataPerUser ¶
MaxLocalMetricsWithMetadataPerUser returns the maximum number of metrics with metadata a user is allowed to store in a single ingester.
func (*Overrides) MaxLocalSeriesPerMetric ¶
MaxLocalSeriesPerMetric returns the maximum number of series allowed per metric in a single ingester.
func (*Overrides) MaxLocalSeriesPerUser ¶
MaxLocalSeriesPerUser returns the maximum number of series a user is allowed to store in a single ingester.
func (*Overrides) MaxMetadataLength ¶
MaxMetadataLength returns maximum length metadata can be. Metadata refers to the Metric Name, HELP and UNIT.
func (*Overrides) MaxQueriersPerUser ¶
MaxQueriersPerUser returns the maximum number of queriers that can handle requests for this user.
func (*Overrides) MaxQueryLength ¶
MaxQueryLength returns the limit of the length (in time) of a query.
func (*Overrides) MaxQueryLookback ¶
MaxQueryLookback returns the max lookback period of queries.
func (*Overrides) MaxQueryParallelism ¶
MaxQueryParallelism returns the limit to the number of split queries the frontend will process in parallel.
func (*Overrides) MaxSamplesPerQuery ¶
MaxSamplesPerQuery returns the maximum number of samples in a query (from the ingester).
func (*Overrides) MaxSeriesPerQuery ¶
MaxSeriesPerQuery returns the maximum number of series a query is allowed to hit.
func (*Overrides) MetricRelabelConfigs ¶
MetricRelabelConfigs returns the metric relabel configs for a given user.
func (*Overrides) MinChunkLength ¶
MinChunkLength returns the minimum size of chunk that will be saved by ingesters
func (*Overrides) NotificationBurstSize ¶
func (*Overrides) NotificationRateLimit ¶
func (*Overrides) RejectOldSamples ¶
RejectOldSamples returns true when we should reject samples older than certain age.
func (*Overrides) RejectOldSamplesMaxAge ¶
RejectOldSamplesMaxAge returns the age at which samples should be rejected.
func (*Overrides) RulerMaxRuleGroupsPerTenant ¶
RulerMaxRuleGroupsPerTenant returns the maximum number of rule groups for a given user.
func (*Overrides) RulerMaxRulesPerRuleGroup ¶
RulerMaxRulesPerRuleGroup returns the maximum number of rules per rule group for a given user.
func (*Overrides) RulerTenantShardSize ¶
RulerTenantShardSize returns shard size (number of rulers) used by this tenant when using shuffle-sharding strategy.
func (*Overrides) S3SSEKMSEncryptionContext ¶
S3SSEKMSEncryptionContext returns the per-tenant S3 KMS-SSE encryption context.
func (*Overrides) S3SSEKMSKeyID ¶
S3SSEKMSKeyID returns the per-tenant S3 KMS-SSE key id.
func (*Overrides) StoreGatewayTenantShardSize ¶
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