From a7bfacbee24b11e2e46f2b4cce16f4152885a342 Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Fri, 10 Apr 2020 11:41:11 -0500 Subject: [PATCH] Revert "Add tags to MaxRow metric" This reverts commit 6013e7211b3aef93d0880401c8ef74b34a620328. --- fragment.go | 9 ++------- prometheus/prometheus.go | 5 ----- stats/stats.go | 31 ++++++------------------------- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/fragment.go b/fragment.go index 3f46c5444..d24c856d2 100644 --- a/fragment.go +++ b/fragment.go @@ -30,7 +30,6 @@ import ( "os" "runtime/debug" "sort" - "strconv" "strings" "sync" "syscall" @@ -209,9 +208,7 @@ func (f *fragment) Open() error { // Read last bit to determine max row. f.maxRowID = f.storage.Max() / ShardWidth - fieldTag := "field:" + f.field - shardTag := "shard:" + strconv.FormatInt(int64(f.shard), 10) - f.stats.GaugeWithCustomTags(MetricMaximumRow, float64(f.maxRowID), 1.0, []string{fieldTag, shardTag}) + f.stats.Gauge(MetricMaximumRow, float64(f.maxRowID), 1.0) return nil }(); err != nil { f.close() @@ -584,9 +581,7 @@ func (f *fragment) unprotectedSetBit(rowID, columnID uint64) (changed bool, err // Update row count if they have increased. if rowID > f.maxRowID { f.maxRowID = rowID - fieldTag := "field:" + f.field - shardTag := "shard:" + strconv.FormatInt(int64(f.shard), 10) - f.stats.GaugeWithCustomTags(MetricMaximumRow, float64(f.maxRowID), 1.0, []string{fieldTag, shardTag}) + f.stats.Gauge(MetricMaximumRow, float64(f.maxRowID), 1.0) } return changed, nil diff --git a/prometheus/prometheus.go b/prometheus/prometheus.go index 8dfd966ec..551996fb9 100644 --- a/prometheus/prometheus.go +++ b/prometheus/prometheus.go @@ -202,11 +202,6 @@ func (c *prometheusClient) Gauge(name string, value float64, rate float64) { gauge.Set(float64(value)) } -// GaugeWithCustomTags sets the value of a metric with custom tags. -func (c *prometheusClient) GaugeWithCustomTags(name string, value float64, rate float64, t []string) { - c.WithTags(append(c.tags, t...)...).Gauge(name, value, rate) -} - // Histogram tracks statistical distribution of a metric. func (c *prometheusClient) Histogram(name string, value float64, rate float64) { mu.Lock() diff --git a/stats/stats.go b/stats/stats.go index 226f6611f..c360baab0 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -44,9 +44,6 @@ type StatsClient interface { // Sets the value of a metric. Gauge(name string, value float64, rate float64) - // Sets the value of a metric with custom tags - GaugeWithCustomTags(name string, value float64, rate float64, tags []string) - // Tracks statistical distribution of a metric. Histogram(name string, value float64, rate float64) @@ -76,14 +73,12 @@ func (c *nopStatsClient) WithTags(tags ...string) StatsClient func (c *nopStatsClient) Count(name string, value int64, rate float64) {} func (c *nopStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string) {} func (c *nopStatsClient) Gauge(name string, value float64, rate float64) {} -func (c *nopStatsClient) GaugeWithCustomTags(name string, value float64, rate float64, tags []string) { -} -func (c *nopStatsClient) Histogram(name string, value float64, rate float64) {} -func (c *nopStatsClient) Set(name string, value string, rate float64) {} -func (c *nopStatsClient) Timing(name string, value time.Duration, rate float64) {} -func (c *nopStatsClient) SetLogger(logger logger.Logger) {} -func (c *nopStatsClient) Open() {} -func (c *nopStatsClient) Close() error { return nil } +func (c *nopStatsClient) Histogram(name string, value float64, rate float64) {} +func (c *nopStatsClient) Set(name string, value string, rate float64) {} +func (c *nopStatsClient) Timing(name string, value time.Duration, rate float64) {} +func (c *nopStatsClient) SetLogger(logger logger.Logger) {} +func (c *nopStatsClient) Open() {} +func (c *nopStatsClient) Close() error { return nil } // expvarStatsClient writes stats out to expvars. type expvarStatsClient struct { @@ -137,13 +132,6 @@ func (c *expvarStatsClient) Gauge(name string, value float64, rate float64) { c.m.Set(name, &f) } -// GaugeWithCustomTags Sets the value of a metric with custom tags -func (c *expvarStatsClient) GaugeWithCustomTags(name string, value float64, rate float64, tags []string) { - var f expvar.Float - f.Set(value) - c.m.Set(name, &f) -} - // Histogram tracks statistical distribution of a metric. // This works the same as gauge for this client. func (c *expvarStatsClient) Histogram(name string, value float64, rate float64) { @@ -216,13 +204,6 @@ func (a MultiStatsClient) Gauge(name string, value float64, rate float64) { } } -// GaugeWithCustomTags Sets the value of a metric with custom tags -func (a MultiStatsClient) GaugeWithCustomTags(name string, value float64, rate float64, tags []string) { - for _, c := range a { - c.GaugeWithCustomTags(name, value, rate, tags) - } -} - // Histogram tracks statistical distribution of a metric on all clients. func (a MultiStatsClient) Histogram(name string, value float64, rate float64) { for _, c := range a {