validation

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 29 Imported by: 31

Documentation

Index

Constants

View Source
const (
	LocalIngestionRateStrategy  = "local"
	GlobalIngestionRateStrategy = "global"
)

Supported values for enum limits

View Source
const (

	// ErrQueryTooLong is used in chunk store, querier and query frontend.
	ErrQueryTooLong = "the query time range exceeds the limit (query length: %s, limit: %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"

	// Too many HA clusters is one of the reasons for discarding samples.
	TooManyHAClusters = "too_many_ha_clusters"

	// DroppedByRelabelConfiguration Samples can also be discarded because of relabeling configuration
	DroppedByRelabelConfiguration = "relabel_configuration"
	// DroppedByUserConfigurationOverride Samples discarded due to user configuration removing label __name__
	DroppedByUserConfigurationOverride = "user_label_removal_configuration"

	// The combined length of the label names and values of an Exemplar's LabelSet MUST NOT exceed 128 UTF-8 characters
	// https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars
	ExemplarMaxLabelSetLength = 128
)

Variables

This section is empty.

Functions

func DeletePerUserValidationMetrics added in v1.8.0

func DeletePerUserValidationMetrics(validateMetrics *ValidateMetrics, userID string, log log.Logger)

func MaxDurationPerTenant added in v1.7.0

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 SetDefaultLimitsForYAMLUnmarshalling added in v0.6.0

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 added in v1.7.0

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 added in v1.7.0

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 SmallestPositiveNonZeroFloat64PerTenant added in v1.16.0

func SmallestPositiveNonZeroFloat64PerTenant(tenantIDs []string, f func(string) float64) float64

SmallestPositiveNonZeroFloat64PerTenant 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 ValidateMetadata added in v1.1.0

func ValidateMetadata(validateMetrics *ValidateMetrics, cfg *Limits, userID string, metadata *cortexpb.MetricMetadata) error

ValidateMetadata returns an err if a metric metadata is invalid.

func ValidateNativeHistogram added in v1.18.0

func ValidateNativeHistogram(validateMetrics *ValidateMetrics, limits *Limits, userID string, ls []cortexpb.LabelAdapter, histogramSample cortexpb.Histogram) (cortexpb.Histogram, error)

Types

type AccessDeniedError added in v1.16.0

type AccessDeniedError string

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

func (AccessDeniedError) Error added in v1.16.0

func (e AccessDeniedError) Error() string

type DisabledRuleGroup added in v1.16.0

type DisabledRuleGroup struct {
	Namespace string `yaml:"namespace" doc:"nocli|description=namespace in which the rule group belongs"`
	Name      string `yaml:"name" doc:"nocli|description=name of the rule group"`
	User      string `yaml:"-" doc:"nocli"`
}

type DisabledRuleGroups added in v1.16.0

type DisabledRuleGroups []DisabledRuleGroup

type LimitError added in v1.4.0

type LimitError string

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

func (LimitError) Error added in v1.4.0

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"`
	MaxLabelsSizeBytes        int                 `yaml:"max_labels_size_bytes" json:"max_labels_size_bytes"`
	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 */
	MaxNativeHistogramBuckets int                 `yaml:"max_native_histogram_buckets" json:"max_native_histogram_buckets"`

	// Ingester enforced limits.
	// Series
	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"`
	LimitsPerLabelSet        []LimitsPerLabelSet `` /* 166-byte string literal not displayed */

	// 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"`
	// Out-of-order
	OutOfOrderTimeWindow model.Duration `yaml:"out_of_order_time_window" json:"out_of_order_time_window"`
	// Exemplars
	MaxExemplars int `yaml:"max_exemplars" json:"max_exemplars"`

	// Querier enforced limits.
	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"`
	MaxFetchedDataBytesPerQuery  int            `yaml:"max_fetched_data_bytes_per_query" json:"max_fetched_data_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"`
	MaxCacheFreshness            model.Duration `yaml:"max_cache_freshness" json:"max_cache_freshness"`
	MaxQueriersPerTenant         float64        `yaml:"max_queriers_per_tenant" json:"max_queriers_per_tenant"`
	QueryVerticalShardSize       int            `yaml:"query_vertical_shard_size" json:"query_vertical_shard_size" doc:"hidden"`

	// Query Frontend / Scheduler enforced limits.
	MaxOutstandingPerTenant int           `yaml:"max_outstanding_requests_per_tenant" json:"max_outstanding_requests_per_tenant"`
	QueryPriority           QueryPriority `yaml:"query_priority" json:"query_priority" doc:"nocli|description=Configuration for query priority."`

	QueryRejection QueryRejection `yaml:"query_rejection" json:"query_rejection" doc:"nocli|description=Configuration for query rejection."`

	// 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"`
	RulerQueryOffset            model.Duration `yaml:"ruler_query_offset" json:"ruler_query_offset"`

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

	// 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"`
	DisabledRuleGroups                         DisabledRuleGroups `yaml:"disabled_rule_groups" json:"disabled_rule_groups" doc:"nocli|description=list of rule groups to disable"`
	// 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 (*Limits) RegisterFlags

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

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

func (*Limits) UnmarshalJSON added in v1.8.0

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

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Limits) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Limits) Validate added in v0.4.0

func (l *Limits) Validate(shardByAllLabels bool) error

Validate the limits config and returns an error if the validation doesn't pass

type LimitsPerLabelSet added in v1.18.0

type LimitsPerLabelSet struct {
	Limits   LimitsPerLabelSetEntry `yaml:"limits" json:"limits" doc:"nocli"`
	LabelSet labels.Labels          `yaml:"label_set" json:"label_set" doc:"nocli|description=LabelSet which the limit should be applied."`
	Id       string                 `yaml:"-" json:"-" doc:"nocli"`
	Hash     uint64                 `yaml:"-" json:"-" doc:"nocli"`
}

type LimitsPerLabelSetEntry added in v1.18.0

type LimitsPerLabelSetEntry struct {
	MaxSeries int `` /* 239-byte string literal not displayed */
}

type NotificationRateLimitMap added in v1.10.0

type NotificationRateLimitMap map[string]float64

func (NotificationRateLimitMap) MarshalYAML added in v1.10.0

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

MarshalYAML implements yaml.Marshaler.

func (NotificationRateLimitMap) Set added in v1.10.0

Set implements flag.Value

func (NotificationRateLimitMap) String added in v1.10.0

func (m NotificationRateLimitMap) String() string

String implements flag.Value

func (NotificationRateLimitMap) UnmarshalYAML added in v1.10.0

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

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) AlertmanagerMaxAlertsCount added in v1.10.0

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

func (*Overrides) AlertmanagerMaxAlertsSizeBytes added in v1.10.0

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

func (*Overrides) AlertmanagerMaxConfigSize added in v1.10.0

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

func (*Overrides) AlertmanagerMaxDispatcherAggregationGroups added in v1.10.0

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

func (*Overrides) AlertmanagerMaxTemplateSize added in v1.10.0

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

func (*Overrides) AlertmanagerMaxTemplatesCount added in v1.10.0

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

func (*Overrides) AlertmanagerReceiversBlockCIDRNetworks added in v1.10.0

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 added in v1.10.0

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) CompactorBlocksRetentionPeriod added in v1.8.0

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

CompactorBlocksRetentionPeriod returns the retention period for a given user.

func (*Overrides) CompactorTenantShardSize added in v1.13.0

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

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

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) DisabledRuleGroups added in v1.16.0

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

func (*Overrides) DropLabels added in v0.6.0

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 added in v1.1.0

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

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

func (*Overrides) EnforceMetricName

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

EnforceMetricName whether to enforce the presence of a metric name.

func (*Overrides) GetOverridesForUser added in v1.14.0

func (o *Overrides) GetOverridesForUser(userID string) *Limits

GetOverridesForUser returns the per-tenant limits with overrides.

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

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

IngestionBurstSize returns the burst size for ingestion rate.

func (*Overrides) IngestionRate

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

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

func (*Overrides) IngestionRateStrategy added in v0.6.0

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) IngestionTenantShardSize added in v1.5.0

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

IngestionTenantShardSize returns the ingesters shard size for a given user.

func (*Overrides) LimitsPerLabelSet added in v1.18.0

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

LimitsPerLabelSet returns the user limits per labelset across the cluster.

func (*Overrides) MaxCacheFreshness added in v1.2.0

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) MaxChunksPerQueryFromStore added in v1.10.0

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

MaxChunksPerQueryFromStore returns the maximum number of chunks allowed per query when fetching chunks from the long-term storage.

func (*Overrides) MaxDownloadedBytesPerRequest added in v1.16.0

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

MaxDownloadedBytesPerRequest returns the maximum number of bytes to download for each gRPC request in Store Gateway, including any data fetched from cache or object storage.

func (*Overrides) MaxExemplars added in v1.15.0

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

MaxExemplars gets the maximum number of exemplars that will be stored per user. 0 or less means disabled.

func (*Overrides) MaxFetchedChunkBytesPerQuery added in v1.10.0

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) MaxFetchedDataBytesPerQuery added in v1.14.0

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

MaxFetchedDataBytesPerQuery returns the maximum number of bytes for all data allowed per query when fetching from ingesters and blocks storage.

func (*Overrides) MaxFetchedSeriesPerQuery added in v1.10.0

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) MaxGlobalMetadataPerMetric added in v1.1.0

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

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

func (*Overrides) MaxGlobalMetricsWithMetadataPerUser added in v1.1.0

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 added in v0.4.0

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

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

func (*Overrides) MaxGlobalSeriesPerUser added in v0.4.0

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) MaxHAReplicaGroups added in v1.16.0

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

MaxHAReplicaGroups 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) MaxLabelsSizeBytes added in v1.14.0

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

MaxLabelsSizeBytes returns maximum number of label/value pairs timeseries.

func (*Overrides) MaxLocalMetadataPerMetric added in v1.1.0

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

MaxLocalMetadataPerMetric returns the maximum number of metadata allowed per metric in a single ingester.

func (*Overrides) MaxLocalMetricsWithMetadataPerUser added in v1.1.0

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

MaxLocalMetricsWithMetadataPerUser returns the maximum number of metrics with metadata a user is allowed to store in a single ingester.

func (*Overrides) MaxLocalSeriesPerMetric added in v0.4.0

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

MaxLocalSeriesPerMetric returns the maximum number of series allowed per metric in a single ingester.

func (*Overrides) MaxLocalSeriesPerUser added in v0.4.0

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

MaxLocalSeriesPerUser returns the maximum number of series a user is allowed to store in a single ingester.

func (*Overrides) MaxMetadataLength added in v1.1.0

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 added in v1.18.0

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

MaxNativeHistogramBuckets returns the maximum total number of positive and negative buckets of a single native histogram a user is allowed to store.

func (*Overrides) MaxOutstandingPerTenant added in v1.15.0

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

MaxOutstandingPerTenant returns the limit to the maximum number of outstanding requests per tenant per request queue.

func (*Overrides) MaxQueriersPerUser added in v1.5.0

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

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

func (*Overrides) MaxQueryLength

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

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

func (*Overrides) MaxQueryLookback added in v1.6.0

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) MetricRelabelConfigs added in v1.5.0

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

MetricRelabelConfigs returns the metric relabel configs for a given user.

func (*Overrides) NotificationBurstSize added in v1.10.0

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

func (*Overrides) NotificationRateLimit added in v1.10.0

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

func (*Overrides) OutOfOrderTimeWindow added in v1.15.0

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

OutOfOrderTimeWindow returns the allowed time window for ingestion of out-of-order samples.

func (*Overrides) QueryPriority added in v1.17.0

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

QueryPriority returns the query priority config for the tenant, including different priorities and their attributes

func (*Overrides) QueryRejection added in v1.18.0

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

QueryRejection returns the query reject config for the tenant

func (*Overrides) QueryVerticalShardSize added in v1.14.0

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

QueryVerticalShardSize returns the number of shards to use when distributing shardable PromQL 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) RulerMaxRuleGroupsPerTenant added in v1.5.0

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

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

func (*Overrides) RulerMaxRulesPerRuleGroup added in v1.5.0

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

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

func (*Overrides) RulerQueryOffset added in v1.18.0

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

RulerQueryOffset returns the rule query offset for a given user.

func (*Overrides) RulerTenantShardSize added in v1.5.0

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 added in v1.8.0

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

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

func (*Overrides) S3SSEKMSKeyID added in v1.8.0

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

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

func (*Overrides) S3SSEType added in v1.8.0

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

S3SSEType returns the per-tenant S3 SSE type.

func (*Overrides) StoreGatewayTenantShardSize added in v1.4.0

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

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

type OverridesExporter added in v1.8.0

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

OverridesExporter exposes per-tenant resource limit overrides as Prometheus metrics

func NewOverridesExporter added in v1.8.0

func NewOverridesExporter(tenantLimits TenantLimits) *OverridesExporter

NewOverridesExporter creates an OverridesExporter that reads updates to per-tenant limits using the provided function.

func (*OverridesExporter) Collect added in v1.8.0

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

func (*OverridesExporter) Describe added in v1.8.0

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

type PriorityDef added in v1.17.0

type PriorityDef struct {
	Priority         int64            `yaml:"priority" json:"priority" doc:"nocli|description=Priority level. Must be a unique value.|default=0"`
	ReservedQueriers float64          `` /* 223-byte string literal not displayed */
	QueryAttributes  []QueryAttribute `` /* 477-byte string literal not displayed */
}

type QueryAttribute added in v1.17.0

type QueryAttribute struct {
	ApiType                string         `` /* 183-byte string literal not displayed */
	Regex                  string         `` /* 176-byte string literal not displayed */
	TimeWindow             TimeWindow     `` /* 217-byte string literal not displayed */
	TimeRangeLimit         TimeRangeLimit `` /* 255-byte string literal not displayed */
	QueryStepLimit         QueryStepLimit `` /* 249-byte string literal not displayed */
	UserAgentRegex         string         `` /* 162-byte string literal not displayed */
	DashboardUID           string         `` /* 299-byte string literal not displayed */
	PanelID                string         `` /* 279-byte string literal not displayed */
	CompiledRegex          *regexp.Regexp
	CompiledUserAgentRegex *regexp.Regexp
}

type QueryPriority added in v1.17.0

type QueryPriority struct {
	Enabled         bool          `yaml:"enabled" json:"enabled"`
	DefaultPriority int64         `yaml:"default_priority" json:"default_priority"`
	Priorities      []PriorityDef `yaml:"priorities" json:"priorities" doc:"nocli|description=List of priority definitions."`
}

type QueryRejection added in v1.18.0

type QueryRejection struct {
	Enabled         bool             `yaml:"enabled" json:"enabled"`
	QueryAttributes []QueryAttribute `` /* 448-byte string literal not displayed */
}

type QueryStepLimit added in v1.18.0

type QueryStepLimit struct {
	Min model.Duration `` /* 149-byte string literal not displayed */
	Max model.Duration `` /* 149-byte string literal not displayed */
}

type TenantLimits added in v0.6.0

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

type TimeRangeLimit added in v1.18.0

type TimeRangeLimit struct {
	Min model.Duration `` /* 292-byte string literal not displayed */
	Max model.Duration `` /* 292-byte string literal not displayed */
}

type TimeWindow added in v1.17.0

type TimeWindow struct {
	Start model.Duration `` /* 221-byte string literal not displayed */
	End   model.Duration `` /* 215-byte string literal not displayed */
}

type ValidateMetrics added in v1.18.0

type ValidateMetrics struct {
	DiscardedSamples   *prometheus.CounterVec
	DiscardedExemplars *prometheus.CounterVec
	DiscardedMetadata  *prometheus.CounterVec
}

func NewValidateMetrics added in v1.18.0

func NewValidateMetrics(r prometheus.Registerer) *ValidateMetrics

type ValidationError added in v1.9.0

type ValidationError error

ValidationError is an error returned by series validation.

Ignore stutter warning. nolint:revive

func ValidateExemplar added in v1.10.0

func ValidateExemplar(validateMetrics *ValidateMetrics, userID string, ls []cortexpb.LabelAdapter, e cortexpb.Exemplar) ValidationError

ValidateExemplar returns an error if the exemplar is invalid. The returned error may retain the provided series labels.

func ValidateLabels added in v0.2.0

func ValidateLabels(validateMetrics *ValidateMetrics, limits *Limits, userID string, ls []cortexpb.LabelAdapter, skipLabelNameValidation bool) ValidationError

ValidateLabels returns an err if the labels are invalid. The returned error may retain the provided series labels.

func ValidateSampleTimestamp added in v1.18.0

func ValidateSampleTimestamp(validateMetrics *ValidateMetrics, limits *Limits, userID string, ls []cortexpb.LabelAdapter, timestampMs int64) ValidationError

ValidateSampleTimestamp returns an err if the sample timestamp is invalid. The returned error may retain the provided series labels.

Jump to

Keyboard shortcuts

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