validation

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReasonLabel string = "reason"
	Unknown     Reason = "unknown"
	// InvalidLabels is a reason for discarding profiles which have labels that are invalid.
	InvalidLabels Reason = "invalid_labels"
	// MissingLabels is a reason for discarding profiles which have no labels.
	MissingLabels Reason = "missing_labels"
	// RateLimited is one of the values for the reason to discard samples.
	RateLimited Reason = "rate_limited"

	// NotInIngestionWindow is a reason for discarding profiles when Pyroscope doesn't accept profiles
	// that are outside of the ingestion window.
	NotInIngestionWindow Reason = "not_in_ingestion_window"

	// MaxLabelNamesPerSeries is a reason for discarding a request which has too many label names
	MaxLabelNamesPerSeries Reason = "max_label_names_per_series"
	// LabelNameTooLong is a reason for discarding a request which has a label name too long
	LabelNameTooLong Reason = "label_name_too_long"
	// LabelValueTooLong is a reason for discarding a request which has a label value too long
	LabelValueTooLong Reason = "label_value_too_long"
	// DuplicateLabelNames is a reason for discarding a request which has duplicate label names
	DuplicateLabelNames Reason = "duplicate_label_names"
	// SeriesLimit is a reason for discarding lines when we can't create a new stream
	// because the limit of active streams has been reached.
	SeriesLimit       Reason = "series_limit"
	QueryLimit        Reason = "query_limit"
	SamplesLimit      Reason = "samples_limit"
	ProfileSizeLimit  Reason = "profile_size_limit"
	SampleLabelsLimit Reason = "sample_labels_limit"
	MalformedProfile  Reason = "malformed_profile"
	FlameGraphLimit   Reason = "flamegraph_limit"

	SeriesLimitErrorMsg                 = "" /* 188-byte string literal not displayed */
	MissingLabelsErrorMsg               = "error at least one label pair is required per profile"
	InvalidLabelsErrorMsg               = "invalid labels '%s' with error: %s"
	MaxLabelNamesPerSeriesErrorMsg      = "profile series '%s' has %d label names; limit %d"
	LabelNameTooLongErrorMsg            = "profile with labels '%s' has label name too long: '%s'"
	LabelValueTooLongErrorMsg           = "profile with labels '%s' has label value too long: '%s'"
	DuplicateLabelNamesErrorMsg         = "profile with labels '%s' has duplicate label name: '%s'"
	QueryTooLongErrorMsg                = "the query time range exceeds the limit (max_query_length, actual: %s, limit: %s)"
	ProfileTooBigErrorMsg               = "the profile with labels '%s' exceeds the size limit (max_profile_size_byte, actual: %d, limit: %d)"
	ProfileTooManySamplesErrorMsg       = "the profile with labels '%s' exceeds the samples count limit (max_profile_stacktrace_samples, actual: %d, limit: %d)"
	ProfileTooManySampleLabelsErrorMsg  = "the profile with labels '%s' exceeds the sample labels limit (max_profile_stacktrace_sample_labels, actual: %d, limit: %d)"
	NotInIngestionWindowErrorMsg        = "profile with labels '%s' is outside of ingestion window (profile timestamp: %s, %s)"
	MaxFlameGraphNodesErrorMsg          = "max flamegraph nodes limit %d is greater than allowed %d"
	MaxFlameGraphNodesUnlimitedErrorMsg = "max flamegraph nodes limit must be set (max allowed %d)"
)
View Source
const (

	// MinCompactorPartialBlockDeletionDelay is the minimum partial blocks deletion delay that can be configured in Mimir.
	// Partial blocks are blocks that are not having meta file uploaded yet.
	MinCompactorPartialBlockDeletionDelay = 4 * time.Hour
)

Variables

View Source
var (
	// DiscardedBytes is a metric of the total discarded bytes, by reason.
	DiscardedBytes = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "pyroscope",
			Name:      "discarded_bytes_total",
			Help:      "The total number of bytes that were discarded.",
		},
		[]string{ReasonLabel, "tenant"},
	)

	// DiscardedProfiles is a metric of the number of discarded profiles, by reason.
	DiscardedProfiles = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "pyroscope",
			Name:      "discarded_samples_total",
			Help:      "The total number of samples that were discarded.",
		},
		[]string{ReasonLabel, "tenant"},
	)
)

Functions

func SetDefaultLimitsForYAMLUnmarshalling

func SetDefaultLimitsForYAMLUnmarshalling(defaults Limits)

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

func TenantLimitsHandler

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

TenantLimitsHandler handles user limits.

func ValidateLabels

func ValidateLabels(limits LabelValidationLimits, tenantID string, ls []*typesv1.LabelPair) error

ValidateLabels validates the labels of a profile.

func ValidateMaxNodes added in v1.2.0

func ValidateMaxNodes(l FlameGraphLimits, tenantIDs []string, n int64) (int64, error)

func ValidateProfile

func ValidateProfile(limits ProfileValidationLimits, tenantID string, prof *googlev1.Profile, uncompressedSize int, ls phlaremodel.Labels, now model.Time) error

Types

type Error

type Error struct {
	Reason Reason
	// contains filtered or unexported fields
}

func NewErrorf

func NewErrorf(reason Reason, msg string, args ...interface{}) *Error

func (*Error) Error

func (e *Error) Error() string

type FlameGraphLimits added in v1.2.0

type FlameGraphLimits interface {
	MaxFlameGraphNodesDefault(string) int
	MaxFlameGraphNodesMax(string) int
}

type LabelValidationLimits

type LabelValidationLimits interface {
	MaxLabelNameLength(tenantID string) int
	MaxLabelValueLength(tenantID string) int
	MaxLabelNamesPerSeries(tenantID string) int
}

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.
	IngestionRateMB        float64 `yaml:"ingestion_rate_mb" json:"ingestion_rate_mb"`
	IngestionBurstSizeMB   float64 `yaml:"ingestion_burst_size_mb" json:"ingestion_burst_size_mb"`
	MaxLabelNameLength     int     `yaml:"max_label_name_length" json:"max_label_name_length"`
	MaxLabelValueLength    int     `yaml:"max_label_value_length" json:"max_label_value_length"`
	MaxLabelNamesPerSeries int     `yaml:"max_label_names_per_series" json:"max_label_names_per_series"`
	MaxSessionsPerSeries   int     `yaml:"max_sessions_per_series" json:"max_sessions_per_series"`

	MaxProfileSizeBytes              int `yaml:"max_profile_size_bytes" json:"max_profile_size_bytes"`
	MaxProfileStacktraceSamples      int `yaml:"max_profile_stacktrace_samples" json:"max_profile_stacktrace_samples"`
	MaxProfileStacktraceSampleLabels int `yaml:"max_profile_stacktrace_sample_labels" json:"max_profile_stacktrace_sample_labels"`
	MaxProfileStacktraceDepth        int `yaml:"max_profile_stacktrace_depth" json:"max_profile_stacktrace_depth"`
	MaxProfileSymbolValueLength      int `yaml:"max_profile_symbol_value_length" json:"max_profile_symbol_value_length"`

	// Distributor aggregation.
	DistributorAggregationWindow model.Duration `yaml:"distributor_aggregation_window" json:"distributor_aggregation_window"`
	DistributorAggregationPeriod model.Duration `yaml:"distributor_aggregation_period" json:"distributor_aggregation_period"`

	// The tenant shard size determines the how many ingesters a particular
	// tenant will be sharded to. Needs to be specified on distributors for
	// correct distribution and on ingesters so that the local ingestion limit
	// can be calculated correctly.
	IngestionTenantShardSize int `yaml:"ingestion_tenant_shard_size" json:"ingestion_tenant_shard_size"`

	// Ingester enforced limits.
	MaxLocalSeriesPerTenant  int `yaml:"max_local_series_per_tenant" json:"max_local_series_per_tenant"`
	MaxGlobalSeriesPerTenant int `yaml:"max_global_series_per_tenant" json:"max_global_series_per_tenant"`

	// Querier enforced limits.
	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"`

	// FlameGraph enforced limits.
	MaxFlameGraphNodesDefault int `yaml:"max_flamegraph_nodes_default" json:"max_flamegraph_nodes_default"`
	MaxFlameGraphNodesMax     int `yaml:"max_flamegraph_nodes_max" json:"max_flamegraph_nodes_max"`

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

	// Query frontend.
	QuerySplitDuration model.Duration `yaml:"split_queries_by_interval" json:"split_queries_by_interval"`

	// 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"`
	CompactorSplitAndMergeStageSize    int            `yaml:"compactor_split_and_merge_stage_size" json:"compactor_split_and_merge_stage_size"`
	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"`
	CompactorDownsamplerEnabled        bool           `yaml:"compactor_downsampler_enabled" json:"compactor_downsampler_enabled"`

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

	// Ensure profiles are dated within the IngestionWindow of the distributor.
	RejectOlderThan model.Duration `yaml:"reject_older_than" json:"reject_older_than"`
	RejectNewerThan model.Duration `yaml:"reject_newer_than" json:"reject_newer_than"`
}

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

func MockDefaultLimits

func MockDefaultLimits() *Limits

func (*Limits) RegisterFlags

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

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

func (*Limits) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Limits) Validate

func (l *Limits) Validate() error

Validate validates that this limits config is valid.

type MockLimits

type MockLimits struct {
	QuerySplitDurationValue     time.Duration
	MaxQueryParallelismValue    int
	MaxQueryLengthValue         time.Duration
	MaxQueryLookbackValue       time.Duration
	MaxLabelNameLengthValue     int
	MaxLabelValueLengthValue    int
	MaxLabelNamesPerSeriesValue int

	MaxFlameGraphNodesDefaultValue int
	MaxFlameGraphNodesMaxValue     int

	DistributorAggregationWindowValue time.Duration
	DistributorAggregationPeriodValue time.Duration

	RejectOlderThanValue time.Duration
	RejectNewerThanValue time.Duration

	MaxProfileSizeBytesValue              int
	MaxProfileStacktraceSamplesValue      int
	MaxProfileStacktraceDepthValue        int
	MaxProfileStacktraceSampleLabelsValue int
	MaxProfileSymbolValueLengthValue      int
}

func (MockLimits) DistributorAggregationPeriod added in v1.2.0

func (m MockLimits) DistributorAggregationPeriod(userID string) time.Duration

func (MockLimits) DistributorAggregationWindow added in v1.2.0

func (m MockLimits) DistributorAggregationWindow(userID string) time.Duration

func (MockLimits) MaxFlameGraphNodesDefault added in v1.2.0

func (m MockLimits) MaxFlameGraphNodesDefault(string) int

func (MockLimits) MaxFlameGraphNodesMax added in v1.2.0

func (m MockLimits) MaxFlameGraphNodesMax(string) int

func (MockLimits) MaxLabelNameLength

func (m MockLimits) MaxLabelNameLength(userID string) int

func (MockLimits) MaxLabelNamesPerSeries

func (m MockLimits) MaxLabelNamesPerSeries(userID string) int

func (MockLimits) MaxLabelValueLength

func (m MockLimits) MaxLabelValueLength(userID string) int

func (MockLimits) MaxProfileSizeBytes

func (m MockLimits) MaxProfileSizeBytes(userID string) int

func (MockLimits) MaxProfileStacktraceDepth

func (m MockLimits) MaxProfileStacktraceDepth(userID string) int

func (MockLimits) MaxProfileStacktraceSampleLabels

func (m MockLimits) MaxProfileStacktraceSampleLabels(userID string) int

func (MockLimits) MaxProfileStacktraceSamples

func (m MockLimits) MaxProfileStacktraceSamples(userID string) int

func (MockLimits) MaxProfileSymbolValueLength

func (m MockLimits) MaxProfileSymbolValueLength(userID string) int

func (MockLimits) MaxQueryLength

func (m MockLimits) MaxQueryLength(tenantID string) time.Duration

func (MockLimits) MaxQueryLookback

func (m MockLimits) MaxQueryLookback(tenantID string) time.Duration

func (MockLimits) MaxQueryParallelism

func (m MockLimits) MaxQueryParallelism(string) int

func (MockLimits) QuerySplitDuration

func (m MockLimits) QuerySplitDuration(string) time.Duration

func (MockLimits) RejectNewerThan added in v1.1.0

func (m MockLimits) RejectNewerThan(userID string) time.Duration

func (MockLimits) RejectOlderThan added in v1.1.0

func (m MockLimits) RejectOlderThan(userID string) time.Duration

type Overrides

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

Overrides periodically fetch a set of per-tenant 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) AllByTenantID

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

func (*Overrides) CompactorBlocksRetentionPeriod added in v1.2.0

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

CompactorBlocksRetentionPeriod returns the retention period for a given user.

func (*Overrides) CompactorDownsamplerEnabled added in v1.3.0

func (o *Overrides) CompactorDownsamplerEnabled(userId string) bool

CompactorDownsamplerEnabled returns true if the downsampler is enabled for a given user.

func (*Overrides) CompactorPartialBlockDeletionDelay added in v1.2.0

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

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

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

func (*Overrides) CompactorSplitAndMergeStageSize added in v1.2.0

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

CompactorSplitAndMergeStageSize returns the number of stages split shards will be written to.

func (*Overrides) CompactorSplitGroups added in v1.2.0

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

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

func (*Overrides) CompactorTenantShardSize added in v1.2.0

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

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

func (*Overrides) DefaultLimits

func (o *Overrides) DefaultLimits() *Limits

func (*Overrides) DistributorAggregationPeriod added in v1.2.0

func (o *Overrides) DistributorAggregationPeriod(tenantID string) model.Duration

func (*Overrides) DistributorAggregationWindow added in v1.2.0

func (o *Overrides) DistributorAggregationWindow(tenantID string) model.Duration

func (*Overrides) IngestionBurstSizeBytes

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

IngestionBurstSizeBytes returns the burst size for ingestion rate.

func (*Overrides) IngestionRateBytes

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

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

func (*Overrides) IngestionTenantShardSize

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

IngestionTenantShardSize returns the ingesters shard size for a given user.

func (*Overrides) MaxFlameGraphNodesDefault added in v1.2.0

func (o *Overrides) MaxFlameGraphNodesDefault(tenantID string) int

MaxFlameGraphNodesDefault returns the max flamegraph nodes used by default.

func (*Overrides) MaxFlameGraphNodesMax added in v1.2.0

func (o *Overrides) MaxFlameGraphNodesMax(tenantID string) int

MaxFlameGraphNodesMax returns the max flamegraph nodes allowed.

func (*Overrides) MaxGlobalSeriesPerTenant

func (o *Overrides) MaxGlobalSeriesPerTenant(tenantID string) int

MaxGlobalSeriesPerTenant returns the maximum number of series a tenant is allowed to store across the cluster.

func (*Overrides) MaxLabelNameLength

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

MaxLabelNameLength returns maximum length a label name can be.

func (*Overrides) MaxLabelNamesPerSeries

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

MaxLabelNamesPerSeries returns maximum number of label/value pairs timeseries.

func (*Overrides) MaxLabelValueLength

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

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

func (*Overrides) MaxLocalSeriesPerTenant

func (o *Overrides) MaxLocalSeriesPerTenant(tenantID string) int

MaxLocalSeriesPerTenant returns the maximum number of series a tenant is allowed to store in a single ingester.

func (*Overrides) MaxProfileSizeBytes

func (o *Overrides) MaxProfileSizeBytes(tenantID string) int

MaxProfileSizeBytes returns the maximum size of a profile in bytes.

func (*Overrides) MaxProfileStacktraceDepth

func (o *Overrides) MaxProfileStacktraceDepth(tenantID string) int

MaxProfileStacktraceDepth returns the maximum depth of a profile stacktrace.

func (*Overrides) MaxProfileStacktraceSampleLabels

func (o *Overrides) MaxProfileStacktraceSampleLabels(tenantID string) int

MaxProfileStacktraceSampleLabels returns the maximum number of labels in a profile sample.

func (*Overrides) MaxProfileStacktraceSamples

func (o *Overrides) MaxProfileStacktraceSamples(tenantID string) int

MaxProfileStacktraceSamples returns the maximum number of samples in a profile.

func (*Overrides) MaxProfileSymbolValueLength

func (o *Overrides) MaxProfileSymbolValueLength(tenantID string) int

MaxProfileSymbolValueLength returns the maximum length of a profile symbol value (labels, function name and filename, etc...).

func (*Overrides) MaxQueriersPerTenant

func (o *Overrides) MaxQueriersPerTenant(tenant string) int

MaxQueriersPerTenant returns the limit to the number of queriers that can be used Shuffle sharding will be used to distribute queries across queriers. 0 means no limit. Currently disabled.

func (*Overrides) MaxQueryLength

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

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

func (*Overrides) MaxQueryLookback

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

MaxQueryLookback returns the max lookback period of queries.

func (*Overrides) MaxQueryParallelism

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

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

func (*Overrides) MaxSessionsPerSeries added in v1.1.0

func (o *Overrides) MaxSessionsPerSeries(tenantID string) int

MaxSessionsPerSeries returns the maximum number of sessions per single series.

func (*Overrides) QuerySplitDuration

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

QuerySplitDuration returns the tenant specific split by interval applied in the query frontend.

func (*Overrides) RejectNewerThan added in v1.1.0

func (o *Overrides) RejectNewerThan(tenantID string) time.Duration

RejectNewerThan will ensure that profiles are further than the return value into the future are reject.

func (*Overrides) RejectOlderThan added in v1.1.0

func (o *Overrides) RejectOlderThan(tenantID string) time.Duration

RejectOlderThan will ensure that profiles that are older than the return value are rejected.

func (*Overrides) S3SSEKMSEncryptionContext added in v1.2.0

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

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

func (*Overrides) S3SSEKMSKeyID added in v1.2.0

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

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

func (*Overrides) S3SSEType added in v1.2.0

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

S3SSEType returns the per-tenant S3 SSE type.

func (*Overrides) StoreGatewayTenantShardSize

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

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

type OverwriteMarshalingStringMap

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

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

func NewOverwriteMarshalingStringMap

func NewOverwriteMarshalingStringMap(m map[string]string) OverwriteMarshalingStringMap

func (*OverwriteMarshalingStringMap) Map

func (OverwriteMarshalingStringMap) MarshalJSON

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

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

func (OverwriteMarshalingStringMap) MarshalYAML

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

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

func (*OverwriteMarshalingStringMap) UnmarshalJSON

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

func (*OverwriteMarshalingStringMap) UnmarshalYAML

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

type ProfileValidationLimits

type ProfileValidationLimits interface {
	MaxProfileSizeBytes(tenantID string) int
	MaxProfileStacktraceSamples(tenantID string) int
	MaxProfileStacktraceSampleLabels(tenantID string) int
	MaxProfileStacktraceDepth(tenantID string) int
	MaxProfileSymbolValueLength(tenantID string) int
	RejectNewerThan(tenantID string) time.Duration
	RejectOlderThan(tenantID string) time.Duration
}

type RangeRequestLimits

type RangeRequestLimits interface {
	MaxQueryLength(tenantID string) time.Duration
	MaxQueryLookback(tenantID string) time.Duration
}

type Reason

type Reason string

func ReasonOf

func ReasonOf(err error) Reason

type TenantLimits

type TenantLimits interface {
	// TenantLimits is a function that returns limits for given tenant, or
	// nil, if there are no tenant-specific limits.
	TenantLimits(tenantID string) *Limits
	// AllByTenantID gets a mapping of all tenant IDs and limits for that tenant
	AllByTenantID() map[string]*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 TenantLimitsResponse

type TenantLimitsResponse struct {
	// Write path limits
	IngestionRate            float64 `json:"ingestion_rate"`
	IngestionBurstSize       int     `json:"ingestion_burst_size"`
	MaxGlobalSeriesPerTenant int     `json:"max_global_series_per_user"`
}

type ValidatedRangeRequest

type ValidatedRangeRequest struct {
	model.Interval
	IsEmpty bool
}

func ValidateRangeRequest

func ValidateRangeRequest(limits RangeRequestLimits, tenantIDs []string, req model.Interval, now model.Time) (ValidatedRangeRequest, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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