// SafeGauge submits/updates a gauge, logging errors.
548250
func (s *LoggingStatter) SafeGauge(stat string, value int64, rate float32) {
	if err := s.Gauge(stat, value, rate); err != nil {
		logger.WithError(err).Errorf("Error sending stat %s Gauge to statsd", stat)
	}
}
141803
func (mb *SquareMetrics) AddGauge(name string, callback func() int64) {
	mb.mutex.Lock()
	defer mb.mutex.Unlock()
	mb.gauges = append(mb.gauges, gaugeWithCallback{metrics.GetOrRegisterGauge(name, mb.Registry), callback})
}
746616
func SetGauge(key []string, val float32) {
	normalizeKeys(key)

	GetMetrics().SetGauge(key, val)
}
1241754
func (s *CirconusSink) SetGauge(key []string, val float32) {
	flatKey := s.flattenKey(key)
	s.metrics.SetGauge(flatKey, int64(val))
}
572208
func (s *server) GetAllGauges(in *metricspb.EmptyMessage, stream metricspb.MetricsService_GetAllGaugesServer) error {
	s.mutex.RLock()
	defer s.mutex.RUnlock()

	for name, gauge := range s.gauges {
		if err := stream.Send(&metricspb.GaugeResponse{Name: name, Value: &metricspb.GaugeResponse_LongValue{LongValue: gauge.get()}}); err != nil {
			return err
		}
	}
	return nil
}
325908
func (n *NodeAuthorizer) safelyAuthorizeNode(ctx context.Context, request *NodeRegistration) error {
	// @step: attempt to authorize the request
	now := time.Now()
	if err := n.authorizer.Authorize(ctx, request); err != nil {
		authorizerErrorMetric.Inc()

		return err
	}
	authorizerLatencyMetric.Observe(time.Since(now).Seconds())

	// @check if the node is registered already
	if n.config.UseFeature(CheckRegistration) {
		if found, err := isNodeRegistered(ctx, n.client, request.Spec.NodeName); err != nil {
			return fmt.Errorf("unable to check node registration status: %s", err)
		} else if found {
			request.Deny(fmt.Sprintf("node %s already registered", request.Spec.NodeName))
		}
	}

	return nil
}
488370
func (id ID) SafeType() (Type, error) {
	switch id.id[idByteLen-1] {
	case idSuffix:
		return Private, nil
	case pubIDSuffix:
		return Public, nil
	case singleTeamIDSuffix:
		return SingleTeam, nil
	default:
		return Unknown, fmt.Errorf("Unknown ID suffix  %x", id.id[idByteLen-1])
	}
}
273915
func (t *Table) unsafeSort(cfg SortConfig) {
	if cfg == nil {
		return
	}
	sort.Sort(bySortConfig{t.Data, cfg})
}
619531
func (s *sender) Gauge(stat string, value float64, tags ...string) {
	s.c <- fmt.Sprintf("%s:%f|g%s\n", stat, value, t(tags))
}
13897
func (s *LoggingStatter) SafeTimingDuration(stat string, delta time.Duration, rate float32) {
	if err := s.TimingDuration(stat, delta, rate); err != nil {
		logger.WithError(err).Errorf("Error sending stat %s TimingDuration to statsd", stat)
	}
}
66177
func SetGauge(key []string, val float32) {
	globalMetrics.Load().(*Metrics).SetGauge(key, val)
}
326833
func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge {
	c := NewFunctionalGauge(f)
	if nil == r {
		r = DefaultRegistry
	}
	r.Register(name, c)
	return c
}
839217
func NewGaugeFrom(opts prometheus.GaugeOpts, labelNames []string) *Gauge {
	gv := prometheus.NewGaugeVec(opts, labelNames)
	prometheus.MustRegister(gv)
	return NewGauge(gv)
}
944715
func (p *statsdProvider) NewGauge(name string) metrics.Gauge {
	return p.s.NewGauge(name)
}
368961
func (h *Health) safeUpdateState(stateEntry *State) {
	// dispatch any status listeners
	h.handleStatusListener(stateEntry)

	// update states here
	h.statesLock.Lock()
	defer h.statesLock.Unlock()

	h.states[stateEntry.Name] = *stateEntry
}
1072823
func SafeSub(x, y uint64) (uint64, bool) {
	return x - y, x < y
}
600653
func GetGaugePluginVersion(pluginName string) (string, error) {
	pluginProperties, err := GetPluginProperties(fmt.Sprintf("%s.json", pluginName))
	if err != nil {
		return "", fmt.Errorf("Failed to get gauge %s properties file. %s", pluginName, err)
	}
	return pluginProperties["version"].(string), nil
}