func (m *Metrics) Gauge(metric string, value int64) { if m.storeSnapshots { m.Lock() m.gauge[metric] = value m.Unlock() } /* *if m.logger.ShouldLog(DEBUG) { * m.logger.Debug("metrics", "gauge."+metric, * LogFields{"value": strconv.FormatInt(value, 10), * "type": "gauge"}) *} */ if statsd := m.statsd; statsd != nil { if value >= 0 { statsd.Gauge(metric, value, 1.0) return } // Gauges cannot be set to negative values; sign prefixes indicate deltas. if err := statsd.Gauge(metric, 0, 1.0); err != nil { return } statsd.GaugeDelta(metric, value, 1.0) } }
func (m *Metrics) Gauge(metric string, value int64) { if m.storeSnapshots { m.Lock() m.gauge[metric] = value m.Unlock() } if statsd := m.statsd; statsd != nil { if value >= 0 { statsd.Gauge(m.formatGauge(metric), value, 1.0) return } // Gauges cannot be set to negative values; sign prefixes indicate deltas. if err := statsd.Gauge(m.formatGauge(metric), 0, 1.0); err != nil { return } statsd.GaugeDelta(m.formatGauge(metric), value, 1.0) } }