gauge.go
func (m *CirconusMetrics) AddGauge(metric string, val interface{}) {
	m.gm.Lock()
	defer m.gm.Unlock()

	v, ok := m.gauges[metric]
	if !ok {
		m.gauges[metric] = val
		return
	}

	switch val.(type) {
	default:
		// ignore it, unsupported type
	case int:
		m.gauges[metric] = v.(int) + val.(int)
	case int8:
		m.gauges[metric] = v.(int8) + val.(int8)
	case int16:
		m.gauges[metric] = v.(int16) + val.(int16)
	case int32:
		m.gauges[metric] = v.(int32) + val.(int32)
	case int64:
		m.gauges[metric] = v.(int64) + val.(int64)
	case uint:
		m.gauges[metric] = v.(uint) + val.(uint)
	case uint8:
		m.gauges[metric] = v.(uint8) + val.(uint8)
	case uint16:
		m.gauges[metric] = v.(uint16) + val.(uint16)
	case uint32:
		m.gauges[metric] = v.(uint32) + val.(uint32)
	case uint64:
		m.gauges[metric] = v.(uint64) + val.(uint64)
	case float32:
		m.gauges[metric] = v.(float32) + val.(float32)
	case float64:
		m.gauges[metric] = v.(float64) + val.(float64)
	}
}
func (m *CirconusMetrics) AddGauge(metric string, val interface{}) {
	m.gm.Lock()
	defer m.gm.Unlock()

	v, ok := m.gauges[metric]
	if !ok {
		m.gauges[metric] = val
		return
	}

	switch val.(type) {
	default:
		// ignore it, unsupported type
	case int:
		m.gauges[metric] = v.(int) + val.(int)
	case int8:
		m.gauges[metric] = v.(int8) + val.(int8)
	case int16:
		m.gauges[metric] = v.(int16) + val.(int16)
	case int32:
		m.gauges[metric] = v.(int32) + val.(int32)
	case int64:
		m.gauges[metric] = v.(int64) + val.(int64)
	case uint:
		m.gauges[metric] = v.(uint) + val.(uint)
	case uint8:
		m.gauges[metric] = v.(uint8) + val.(uint8)
	case uint16:
		m.gauges[metric] = v.(uint16) + val.(uint16)
	case uint32:
		m.gauges[metric] = v.(uint32) + val.(uint32)
	case uint64:
		m.gauges[metric] = v.(uint64) + val.(uint64)
	case float32:
		m.gauges[metric] = v.(float32) + val.(float32)
	case float64:
		m.gauges[metric] = v.(float64) + val.(float64)
	}
}
func ( m * CirconusMetrics ) AddGauge ( metric string , val interface { } ) { m . gm . Lock ( ) defer m . gm . Unlock ( ) v , ok := m . gauges [ metric ] if ! ok { m . gauges [ metric ] = val return } switch val . ( type ) { default : // ignore it, unsupported type case int : m . gauges [ metric ] = v . ( int ) + val . ( int ) case int8 : m . gauges [ metric ] = v . ( int8 ) + val . ( int8 ) case int16 : m . gauges [ metric ] = v . ( int16 ) + val . ( int16 ) case int32 : m . gauges [ metric ] = v . ( int32 ) + val . ( int32 ) case int64 : m . gauges [ metric ] = v . ( int64 ) + val . ( int64 ) case uint : m . gauges [ metric ] = v . ( uint ) + val . ( uint ) case uint8 : m . gauges [ metric ] = v . ( uint8 ) + val . ( uint8 ) case uint16 : m . gauges [ metric ] = v . ( uint16 ) + val . ( uint16 ) case uint32 : m . gauges [ metric ] = v . ( uint32 ) + val . ( uint32 ) case uint64 : m . gauges [ metric ] = v . ( uint64 ) + val . ( uint64 ) case float32 : m . gauges [ metric ] = v . ( float32 ) + val . ( float32 ) case float64 : m . gauges [ metric ] = v . ( float64 ) + val . ( float64 ) } }
// AddGauge adds value to existing gauge
AddGauge adds value to existing gauge