Revert "Add tags to MaxRow metric"

This reverts commit 6013e7211b3aef93d0880401c8ef74b34a620328.
This commit is contained in:
Alan Bernstein 2020-04-10 11:41:11 -05:00 committed by Matt Jaffee
parent b37a0addb3
commit a7bfacbee2
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
3 changed files with 8 additions and 37 deletions

View file

@ -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

View file

@ -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()

View file

@ -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 {