stats

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stats provides various structs for collecting stats

  • Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.

Package stats provides various structs for collecting stats

  • Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetMetricsGauges

func ResetMetricsGauges(c *statsd.Client)

Types

type BaseMetricAgg

type BaseMetricAgg struct {
	// contains filtered or unexported fields
}

type HTTPReq

type HTTPReq struct {
	// contains filtered or unexported fields
}

HTTPReq is used for keeping track of http requests stats including number of ops, latency, throughput, etc. Assume single threaded access, it doesn't provide any locking on updates.

func NewHTTPReq

func NewHTTPReq(t time.Time) HTTPReq

NewHTTPReq returns a new stats object with given time as the starting point

func (*HTTPReq) Add

func (s *HTTPReq) Add(size int64, delta time.Duration)

Add adds a request's result to the stats

func (*HTTPReq) AddErr

func (s *HTTPReq) AddErr()

AddErr increases the number of failed count by 1

func (*HTTPReq) Aggregate

func (s *HTTPReq) Aggregate(other HTTPReq)

Aggregate adds another stats to self

func (*HTTPReq) AvgLatency

func (s *HTTPReq) AvgLatency() int64

AvgLatency returns the avg latency in nano second.

func (*HTTPReq) MaxLatency

func (s *HTTPReq) MaxLatency() int64

MaxLatency returns the maximum latency in nano second.

func (*HTTPReq) MinLatency

func (s *HTTPReq) MinLatency() int64

MinLatency returns the minimal latency in nano second.

func (*HTTPReq) Start

func (s *HTTPReq) Start() time.Time

Start returns the start time of the stats.

func (*HTTPReq) Throughput

func (s *HTTPReq) Throughput(start, end time.Time) int64

Throughput returns throughput of requests (bytes/per second).

func (*HTTPReq) Total

func (s *HTTPReq) Total() int64

Total returns the total number of requests.

func (*HTTPReq) TotalBytes

func (s *HTTPReq) TotalBytes() int64

TotalBytes returns the total number of bytes by all requests.

func (*HTTPReq) TotalErrs

func (s *HTTPReq) TotalErrs() int64

TotalErrs returns the total number of failed requests.

type MetricAgg

type MetricAgg struct {
	MetricLatAgg
	// contains filtered or unexported fields
}

func (*MetricAgg) Add

func (ma *MetricAgg) Add(size int64, lat time.Duration)

func (*MetricAgg) AddErr

func (ma *MetricAgg) AddErr()

func (*MetricAgg) AddPending

func (ma *MetricAgg) AddPending(p int64)

Note: this aggregates pending values (to be averaged at send time). If you ever want "last pending" semantics, change this to assignment.

func (*MetricAgg) AvgLatency

func (ma *MetricAgg) AvgLatency() float64

func (*MetricAgg) Send

func (ma *MetricAgg) Send(c *statsd.Client, mType string, general []statsd.Metric, genAggCnt int64)

func (*MetricAgg) Throughput

func (ma *MetricAgg) Throughput(end time.Time) int64

type MetricLatAgg

type MetricLatAgg struct {
	BaseMetricAgg
	// contains filtered or unexported fields
}

type MetricLatsAgg

type MetricLatsAgg struct {
	// contains filtered or unexported fields
}

func (*MetricLatsAgg) Add

func (mgs *MetricLatsAgg) Add(name string, lat time.Duration)

type Metrics

type Metrics struct {
	Put      MetricAgg
	Get      MetricAgg
	GetBatch MetricAgg
	PutLat   MetricLatsAgg
	GetLat   MetricLatsAgg
}

func NewStatsdMetrics

func NewStatsdMetrics(start time.Time) Metrics

func (*Metrics) SendAll

func (m *Metrics) SendAll(c *statsd.Client)

Directories

Path Synopsis
Package statsd provides a client to send basic statd metrics (timer, counter and gauge) to listening UDP StatsD server.
Package statsd provides a client to send basic statd metrics (timer, counter and gauge) to listening UDP StatsD server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL