// Stats groups that this request will be aggregated under.
357348
func (r *SearchRequest) Stats(statsGroup ...string) *SearchRequest {
	r.searchSource = r.searchSource.Stats(statsGroup...)
	return r
}
1087365
func (a *ReqLatencyCounter) Stats(dimensions map[string]string) []*datapoint.Datapoint {
	now := a.timeKeeper.Now()
	getDp := func(key string, value int64) *datapoint.Datapoint {
		return datapoint.New(
			"ReqLatencyCounter.requestCounts", appendDimensions(dimensions, "requestClass", key),
			datapoint.NewIntValue(value), datapoint.Counter, now)
	}
	return []*datapoint.Datapoint{
		getDp("fast", a.fastRequests),
		getDp("slow", a.slowRequests),
	}
}
75481
func (h *HostStatsCollector) Stats() *HostStats {
	h.hostStatsLock.RLock()
	defer h.hostStatsLock.RUnlock()

	if h.hostStats == nil {
		if err := h.collectLocked(); err != nil {
			h.logger.Warn("error fetching host resource usage stats", "error", err)
		}
	}

	return h.hostStats
}
281727
func (clnt *Client) Stats() (map[string]interface{}, error) {
	resStats := clnt.cluster.statsCopy()

	clusterStats := nodeStats{}
	for _, stats := range resStats {
		clusterStats.aggregate(&stats)
	}

	resStats["cluster-aggregated-stats"] = clusterStats

	b, err := json.Marshal(resStats)
	if err != nil {
		return nil, err
	}

	res := map[string]interface{}{}
	err = json.Unmarshal(b, &res)
	if err != nil {
		return nil, err
	}

	res["open-connections"] = clusterStats.ConnectionsOpen

	return res, nil
}
1144677
func (a *HistoricalApi) clusterAggregations(request *restful.Request, response *restful.Response) {
	key := core.HistoricalKey{ObjectType: core.MetricSetTypeCluster}
	a.processAggregationRequest(key, request, response)
}
1045503
func (c *Cellar) Stats() *Stats {
	rv := &Stats{}
	rv.mergesCompleted = atomic.LoadUint64(&c.stats.mergesCompleted)
	rv.segments = atomic.LoadUint64(&c.stats.segments)
	return rv
}
548602
func (c *ShardedClient) Stat(statsKey string) StatResponse {
	statEntries := make(map[int](map[string]string))

	var err error
	for shard, conn := range c.manager.GetAllShards() {
		response := c.statHelper(shard, conn, statsKey)
		if response.Error() != nil {
			if err == nil {
				err = response.Error()
			} else {
				err = errors.Wrap(response.Error(), err.Error())
			}
		}

		for shardId, entries := range response.Entries() {
			statEntries[shardId] = entries
		}
	}

	if err != nil {
		return NewStatErrorResponse(err, statEntries)
	}

	return NewStatResponse(StatusNoError, statEntries)
}
1056922
func (s *DeleteByQueryService) Stats(stats ...string) *DeleteByQueryService {
	s.stats = append(s.stats, stats...)
	return s
}
259082
func (s *ClientStats) Stats(args *nstructs.NodeSpecificRequest, reply *structs.ClientStatsResponse) error {
	defer metrics.MeasureSince([]string{"client", "client_stats", "stats"}, time.Now())

	// Check node read permissions
	if aclObj, err := s.c.ResolveToken(args.AuthToken); err != nil {
		return err
	} else if aclObj != nil && !aclObj.AllowNodeRead() {
		return nstructs.ErrPermissionDenied
	}

	clientStats := s.c.StatsReporter()
	reply.HostStats = clientStats.LatestHostStats()
	return nil
}
1340160
func (e Increment) Stats() []string {
	return []string{fmt.Sprintf("%s:%d|c", e.Name, e.Value)}
}
1249706
func (this *Beanstalkd) Stats() (map[string]string, error) {
	e := this.send("stats\r\n")
	if e != nil {
		return nil, e
	}
	return this.handleMapResponse()
}
1072452
func (p *BulkProcessor) Stats() BulkProcessorStats {
	p.statsMu.Lock()
	defer p.statsMu.Unlock()
	return *p.stats.dup()
}
736544
func statsForGroup(groupName string, groupStats []*nvml.StatsData, timestamp time.Time) *device.DeviceGroupStats {
	instanceStats := make(map[string]*device.DeviceStats)
	for _, statsItem := range groupStats {
		instanceStats[statsItem.UUID] = statsForItem(statsItem, timestamp)
	}

	return &device.DeviceGroupStats{
		Vendor:        vendor,
		Type:          deviceType,
		Name:          groupName,
		InstanceStats: instanceStats,
	}
}
70404
func (e *EncodeSession) Stats() *EncodeStats {
	s := &EncodeStats{}
	e.Lock()
	if e.lastStats != nil {
		*s = *e.lastStats
	}
	e.Unlock()

	return s
}
461474
func (e Timing) Stats() []string {
	return []string{
		fmt.Sprintf("%s.count:%d|c", e.Name, e.Count),
		fmt.Sprintf("%s.avg:%d|ms", e.Name, int64(e.Value/e.Count)), // make sure e.Count != 0
		fmt.Sprintf("%s.min:%d|ms", e.Name, e.Min),
		fmt.Sprintf("%s.max:%d|ms", e.Name, e.Max),
	}
}
516498
func (v *volumeClient) Stats(
	volumeID string,
	cumulative bool,
) (*api.Stats, error) {
	stats := &api.Stats{}
	req := v.c.Get().Resource(volumePath + "/stats").Instance(volumeID)
	req.QueryOption(api.OptCumulative, strconv.FormatBool(cumulative))

	err := req.Do().Unmarshal(stats)
	return stats, err

}
462565
func (fs *FilteringSink) Stats() string {
	return fmt.Sprintf("%d / %d stores allowed (%.2f%% filter rate)",
		fs.allowedReqs, fs.totalReqs, (1.0-float64(fs.allowedReqs)/float64(fs.totalReqs))*100.0)
}