Skip to content

Commit a532167

Browse files
committed
Removed deprecated --metric-count flag
Fixes #82 Signed-off-by: bwplotka <bwplotka@gmail.com>
1 parent 60d55fd commit a532167

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

metrics/serve.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ type Collector struct {
4949
// NewCollector returns Prometheus collector that can be registered in registry
5050
// that handles metric creation and changes, based on the given configuration.
5151
func NewCollector(cfg Config) *Collector {
52-
if cfg.GaugeMetricCount == 0 {
53-
cfg.GaugeMetricCount = cfg.MetricCount // Handle deprecated field.
54-
}
55-
5652
c := &Collector{
5753
cfg: cfg,
5854
valGen: rand.New(rand.NewSource(time.Now().UnixNano())),
@@ -80,7 +76,7 @@ func (c *Collector) UpdateNotifyCh() chan struct{} {
8076
}
8177

8278
type Config struct {
83-
MetricCount, GaugeMetricCount, CounterMetricCount, HistogramMetricCount, NativeHistogramMetricCount, SummaryMetricCount int
79+
GaugeMetricCount, CounterMetricCount, HistogramMetricCount, NativeHistogramMetricCount, SummaryMetricCount int
8480

8581
HistogramBuckets, SummaryObjectives int
8682

@@ -97,8 +93,6 @@ type Config struct {
9793

9894
func NewConfigFromFlags(flagReg func(name, help string) *kingpin.FlagClause) *Config {
9995
cfg := &Config{}
100-
flagReg("metric-count", "Number of gauge metrics to serve. DEPRECATED use --gauge-metric-count instead").Default("0").
101-
IntVar(&cfg.MetricCount)
10296
// NOTE: By default avalanche creates 500 gauges, to keep old behaviour. We could break compatibility,
10397
// but it's less surprising to ask users to adjust and add more types themselves.
10498
flagReg("gauge-metric-count", "Number of gauge metrics to serve.").Default("500").
@@ -165,9 +159,6 @@ func (c Config) Validate() error {
165159
if c.MinSeriesCount < 0 {
166160
return fmt.Errorf("--min-series-count must be 0 or higher, got %d", c.MinSeriesCount)
167161
}
168-
if c.MetricCount > 0 && c.GaugeMetricCount > 0 {
169-
return fmt.Errorf("--metric-count (set to %v) is deprecated and it means the same as --gauge-metric-count (set to %v); both can't be used in the same time", c.MetricCount, c.GaugeMetricCount)
170-
}
171162
for _, cLabel := range c.ConstLabels {
172163
split := strings.Split(cLabel, "=")
173164
if len(split) != 2 {

0 commit comments

Comments
 (0)