Documentation
¶
Index ¶
Constants ¶
View Source
const (
ProfileAnnotationKeyThrottled = "pyroscope.ingest.throttled"
)
Variables ¶
This section is empty.
Functions ¶
func CreateTenantAnnotation ¶ added in v1.13.3
Types ¶
type Config ¶
type Config struct {
// PeriodType provides the limit period / interval (e.g., "hour"). Used in error messages only.
PeriodType string `yaml:"period_type" json:"period_type"`
// PeriodLimitMb provides the limit that is being set in MB. Used in error messages only.
PeriodLimitMb int `yaml:"period_limit_mb" json:"period_limit_mb"`
// LimitResetTime provides the time (Unix seconds) when the limit will reset. Used in error messages only.
LimitResetTime int64 `yaml:"limit_reset_time" json:"limit_reset_time"`
// LimitReached instructs distributors to allow or reject profiles.
LimitReached bool `yaml:"limit_reached" json:"limit_reached"`
// Sampling controls the sampling parameters when the limit is reached.
Sampling SamplingConfig `yaml:"sampling" json:"sampling"`
// UsageGroups controls ingestion for pre-configured usage groups.
UsageGroups map[string]UsageGroup `yaml:"usage_groups" json:"usage_groups"`
}
type InstanceCountProvider ¶
type InstanceCountProvider interface {
InstancesCount() int
}
type ProfileAnnotation ¶ added in v1.13.3
type ProfileAnnotation struct {
Body interface{} `json:"body"`
}
type Sampler ¶
type Sampler struct {
*services.BasicService
// contains filtered or unexported fields
}
Sampler provides a very simple time-based probabilistic sampling, intended to be used when a tenant limit has been reached.
The sampler will allow a number of requests in a time interval. Once the interval is over, the number of allowed requests resets.
We introduce a probability function for a request to be allowed defined as 1 / num_replicas, to account for the size of the cluster and because tracking is done in memory.
func NewSampler ¶
func NewSampler(instanceCount InstanceCountProvider) *Sampler
func (*Sampler) AllowRequest ¶
func (s *Sampler) AllowRequest(tenantID string, config SamplingConfig) bool
type SamplingConfig ¶
type SamplingConfig struct {
NumRequests int `yaml:"num_requests" json:"num_requests"`
Period time.Duration `yaml:"period" json:"period"`
}
SamplingConfig describes the params of a simple probabilistic sampling mechanism.
Distributors should allow up to NumRequests requests through and then apply a cooldown (Period) after which more requests can be let through.
type ThrottledAnnotation ¶ added in v1.13.3
type UsageGroup ¶
Click to show internal directories.
Click to hide internal directories.