// NewCounter returns a counter, sending observations to this Influxstatsd object.
3430
func (d *Influxstatsd) NewCounter(name string, sampleRate float64) *Counter {
	d.rates.Set(name, sampleRate)
	return &Counter{
		name: name,
		obs:  d.counters.Observe,
	}
}
285070
func NewImportMetricCounter() *ImportMetricCounter {
	return &ImportMetricCounter{
		importSuccessCounts: make(metrics.ImportSuccessCounts),
		importErrorCounts:   make(metrics.ImportErrorCounts),
	}
}
888830
func (p *dogstatsdProvider) NewCounter(name string) metrics.Counter {
	return p.d.NewCounter(name, 1.0)
}
1345219
func (p expvarProvider) NewCounter(name string) metrics.Counter {
	return expvar.NewCounter(name)
}
957225
func NewMonitor(options ...func(*Monitor)) *Monitor {
	m := &Monitor{
		Nodes:                         make([]*Node, 0),
		Network:                       NewNetwork(),
		monitorQuit:                   make(chan struct{}),
		nodeQuit:                      make(map[string]chan struct{}),
		recalculateNetworkUptimeEvery: 10 * time.Second,
		numValidatorsUpdateInterval:   5 * time.Second,
		logger:                        log.NewNopLogger(),
	}

	for _, option := range options {
		option(m)
	}

	return m
}
1360588
func NewCountSpanFilter(minCount, maxCount int64) Filter {
	return &filter{filterType: countSpanFilter, value: []int64{minCount, maxCount}}
}
143128
func (s *Statsd) NewCounter(name string, sampleRate float64) *Counter {
	s.rates.Set(s.prefix+name, sampleRate)
	return &Counter{
		name: s.prefix + name,
		obs:  s.counters.Observe,
	}
}
1232924
func NewCounter(name string, help string) *Counter {
	v := &Counter{help: help}
	if name != "" {
		publish(name, v)
	}
	return v
}
1241764
func NewReporter(r metrics.Registry, addr string, d time.Duration, options ...ReporterOption) (*Reporter, error) {
	if r == nil {
		r = metrics.DefaultRegistry
	}

	client, err := statsd.New(addr)
	if err != nil {
		return nil, err
	}
	reporter := &Reporter{
		Client:   client,
		Registry: r,
		interval: d,
		ss:       make(map[string]int64),
	}
	for _, option := range options {
		if err := option(reporter); err != nil {
			return nil, err
		}
	}
	return reporter, nil
}
189083
func (s *AutoScaleService) NewCreateCounterParams(name string, source string, value string) *CreateCounterParams {
	p := &CreateCounterParams{}
	p.p = make(map[string]interface{})
	p.p["name"] = name
	p.p["source"] = source
	p.p["value"] = value
	return p
}
819004
func NewRatioCounter(buckets int, resolution time.Duration, options ...ratioOptSetter) (*RatioCounter, error) {
	rc := &RatioCounter{}

	for _, o := range options {
		if err := o(rc); err != nil {
			return nil, err
		}
	}

	if rc.clock == nil {
		rc.clock = &timetools.RealTime{}
	}

	a, err := NewCounter(buckets, resolution, CounterClock(rc.clock))
	if err != nil {
		return nil, err
	}

	b, err := NewCounter(buckets, resolution, CounterClock(rc.clock))
	if err != nil {
		return nil, err
	}

	rc.a = a
	rc.b = b
	return rc, nil
}
96415
func NewDevstatCollector() (Collector, error) {
	return &devstatCollector{
		bytesDesc: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, devstatSubsystem, "bytes_total"),
			"The total number of bytes transferred for reads and writes on the device.",
			[]string{"device"}, nil,
		),
		transfersDesc: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, devstatSubsystem, "transfers_total"),
			"The total number of transactions completed.",
			[]string{"device"}, nil,
		),
		blocksDesc: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, devstatSubsystem, "blocks_total"),
			"The total number of bytes given in terms of the devices blocksize.",
			[]string{"device"}, nil,
		),
	}, nil
}
302959
func NewOutCounter(s core.Side, overflowLen int) (c Counter) {
	c.overflowLen = overflowLen
	if s == core.ServerSide {
		// Server counters in ALTS record have the little-endian high bit
		// set.
		c.value[counterLen-1] = 0x80
	}
	return
}
362799
func IncrCounter(key []string, val float32) {
	normalizeKeys(key)

	GetMetrics().IncrCounter(key, val)
}
1066929
func (s *Wrapper) NewWatcher(ctx context.Context, watch Watch) (Watcher, error) {
	if err := s.GetReadError(); err != nil {
		return nil, trace.Wrap(err)
	}
	return s.backend.NewWatcher(ctx, watch)
}
1009258
func NewCountingSampler(rate float64) (Sampler, error) {
	if rate == 0.0 {
		return NeverSample, nil
	}
	if rate == 1.0 {
		return AlwaysSample, nil
	}
	if rate < 0.01 || rate > 1 {
		return nil, fmt.Errorf("rate should be 0.0 or between 0.01 and 1: was %f", rate)
	}
	var (
		i         = 0
		outOf100  = int(rate*100 + math.Copysign(0.5, rate*100)) // for rounding float to int conversion instead of truncation
		decisions = randomBitSet(100, outOf100, rand.New(rand.NewSource(time.Now().UnixNano())))
		mtx       = &sync.Mutex{}
	)

	return func(_ uint64) bool {
		mtx.Lock()
		result := decisions[i]
		i++
		if i == 100 {
			i = 0
		}
		mtx.Unlock()
		return result
	}, nil
}
1304917
func (p *statsdProvider) NewCounter(name string) metrics.Counter {
	return p.s.NewCounter(name, 1.0)
}