stats

package
v1.3.19 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stats provides various structs for collecting stats

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

Package stats provides various structs for collecting stats

  • Copyright (c) 2018-2021, 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 maximal 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(pending int64)

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 MetricConfigAgg

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

func (*MetricConfigAgg) Add

func (mcg *MetricConfigAgg) Add(lat, _, _ time.Duration)

func (*MetricConfigAgg) Send

func (mcg *MetricConfigAgg) Send(c *statsd.Client)

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
	Config MetricConfigAgg
	PutLat MetricLatsAgg
	GetLat MetricLatsAgg
}

func NewStatsdMetrics

func NewStatsdMetrics(start time.Time) Metrics

func (*Metrics) SendAll

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

Jump to

Keyboard shortcuts

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