github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/clients/pkg/promtail/limit/config.go (about) 1 package limit 2 3 import ( 4 "flag" 5 ) 6 7 type Config struct { 8 ReadlineRate float64 `yaml:"readline_rate" json:"readline_rate"` 9 ReadlineBurst int `yaml:"readline_burst" json:"readline_burst"` 10 ReadlineRateEnabled bool `yaml:"readline_rate_enabled,omitempty" json:"readline_rate_enabled"` 11 ReadlineRateDrop bool `yaml:"readline_rate_drop,omitempty" json:"readline_rate_drop"` 12 } 13 14 func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { 15 f.Float64Var(&cfg.ReadlineRate, prefix+"limit.readline-rate", 10000, "The rate limit in log lines per second that this instance of Promtail may push to Loki.") 16 f.IntVar(&cfg.ReadlineBurst, prefix+"limit.readline-burst", 10000, "The cap in the quantity of burst lines that this instance of Promtail may push to Loki.") 17 f.BoolVar(&cfg.ReadlineRateEnabled, prefix+"limit.readline-rate-enabled", false, "When true, enforces rate limiting on this instance of Promtail.") 18 f.BoolVar(&cfg.ReadlineRateDrop, prefix+"limit.readline-rate-drop", true, "When true, exceeding the rate limit causes this instance of Promtail to discard log lines, rather than sending them to Loki.") 19 }