github.com/grafana/pyroscope@v1.18.0/pkg/distributor/ingestlimits/config.go (about)

     1  package ingestlimits
     2  
     3  import "time"
     4  
     5  type Config struct {
     6  	// PeriodType provides the limit period / interval (e.g., "hour"). Used in error messages only.
     7  	PeriodType string `yaml:"period_type" json:"period_type"`
     8  	// PeriodLimitMb provides the limit that is being set in MB. Used in error messages only.
     9  	PeriodLimitMb int `yaml:"period_limit_mb" json:"period_limit_mb"`
    10  	// LimitResetTime provides the time (Unix seconds) when the limit will reset. Used in error messages only.
    11  	LimitResetTime int64 `yaml:"limit_reset_time" json:"limit_reset_time"`
    12  	// LimitReached instructs distributors to allow or reject profiles.
    13  	LimitReached bool `yaml:"limit_reached" json:"limit_reached"`
    14  	// Sampling controls the sampling parameters when the limit is reached.
    15  	Sampling SamplingConfig `yaml:"sampling" json:"sampling"`
    16  	// UsageGroups controls ingestion for pre-configured usage groups.
    17  	UsageGroups map[string]UsageGroup `yaml:"usage_groups" json:"usage_groups"`
    18  }
    19  
    20  // SamplingConfig describes the params of a simple probabilistic sampling mechanism.
    21  //
    22  // Distributors should allow up to NumRequests requests through and then apply a cooldown (Period) after which
    23  // more requests can be let through.
    24  type SamplingConfig struct {
    25  	NumRequests int           `yaml:"num_requests" json:"num_requests"`
    26  	Period      time.Duration `yaml:"period" json:"period"`
    27  }
    28  
    29  type UsageGroup struct {
    30  	PeriodLimitMb int  `yaml:"period_limit_mb" json:"period_limit_mb"`
    31  	LimitReached  bool `yaml:"limit_reached" json:"limit_reached"`
    32  }