stats

package
v1.3.16 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 30 Imported by: 2

Documentation

Overview

Package stats provides methods and functionality to register, track, log, and StatsD-notify statistics that, for the most part, include "counter" and "latency" kinds.

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

Package stats provides methods and functionality to register, track, log, and StatsD-notify statistics that, for the most part, include "counter" and "latency" kinds.

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

Package stats provides methods and functionality to register, track, log, and StatsD-notify statistics that, for the most part, include "counter" and "latency" kinds.

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

Package stats provides methods and functionality to register, track, log, and StatsD-notify statistics that, for the most part, include "counter" and "latency" kinds.

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

Index

Constants

View Source
const (
	// lockless
	KindCounter            = "counter"
	KindSize               = "size"
	KindGauge              = "gauge"
	KindSpecial            = "special"
	KindComputedThroughput = "compbw" // disk read/write throughput
	// compound (+ semantics)
	KindLatency    = "latency"
	KindThroughput = "bw" // e.g. GetThroughput
)

enum: `statsValue` kinds

View Source
const (
	// KindCounter:
	// all basic counters are accompanied by the corresponding (errPrefix + kind) error count:
	// e.g.: "get.n" => "err.get.n", "put.n" => "err.put.n", etc.
	// See also: `IncErr`, `regCommon`
	GetCount    = "get.n"    // counts GET(object)
	PutCount    = "put.n"    // ditto PUT
	AppendCount = "append.n" // ditto etc.
	DeleteCount = "del.n"    // ditto
	RenameCount = "ren.n"    // ditto
	ListCount   = "lst.n"    // list-objects

	// statically defined err counts (NOTE: update regCommon when adding/updating)
	ErrHTTPWriteCount = errPrefix + "http.write.n"
	ErrDownloadCount  = errPrefix + "dl.n"
	ErrPutMirrorCount = errPrefix + "put.mirror.n"

	// KindLatency
	GetLatency       = "get.ns"
	ListLatency      = "lst.ns"
	KeepAliveLatency = "kalive.ns"

	// KindSpecial
	Uptime = "up.ns.time"
)

metrics

View Source
const (
	// KindCounter & KindSize - always incremented
	GetColdCount = "get.cold.n"
	GetColdSize  = "get.cold.size"

	LruEvictCount = "lru.evict.n"
	LruEvictSize  = "lru.evict.size"

	CleanupStoreCount = "cleanup.store.n"
	CleanupStoreSize  = "cleanup.store.size"

	VerChangeCount = "ver.change.n"
	VerChangeSize  = "ver.change.size"

	// intra-cluster transmit & receive
	StreamsOutObjCount = transport.OutObjCount
	StreamsOutObjSize  = transport.OutObjSize
	StreamsInObjCount  = transport.InObjCount
	StreamsInObjSize   = transport.InObjSize

	// errors
	ErrCksumCount    = "err.cksum.n"
	ErrCksumSize     = "err.cksum.size"
	ErrMetadataCount = "err.md.n"
	ErrIOCount       = "err.io.n"
	// special
	RestartCount = "restart.n"

	// KindLatency
	PutLatency      = "put.ns"
	AppendLatency   = "append.ns"
	GetRedirLatency = "get.redir.ns"
	PutRedirLatency = "put.redir.ns"
	DownloadLatency = "dl.ns"

	// DSort
	DSortCreationReqCount    = "dsort.creation.req.n"
	DSortCreationReqLatency  = "dsort.creation.req.ns"
	DSortCreationRespCount   = "dsort.creation.resp.n"
	DSortCreationRespLatency = "dsort.creation.resp.ns"

	// Downloader
	DownloadSize = "dl.size"

	// KindThroughput
	GetThroughput = "get.bps" // bytes per second
	PutThroughput = "put.bps" // ditto

	// same as above via `.cumulative`
	GetSize = "get.size"
	PutSize = "put.size"
)

Naming Convention:

-> "*.n" - counter
-> "*.ns" - latency (nanoseconds)
-> "*.size" - size (bytes)
-> "*.bps" - throughput (in byte/s)
-> "*.id" - ID

Variables

This section is empty.

Functions

func IsErrMetric added in v1.3.16

func IsErrMetric(name string) bool

Types

type Cluster added in v1.3.16

type Cluster struct {
	Proxy  *Node            `json:"proxy"`
	Target map[string]*Node `json:"target"`
}

type ClusterRaw added in v1.3.16

type ClusterRaw struct {
	Proxy  *Node           `json:"proxy"`
	Target cos.JSONRawMsgs `json:"target"`
}

type Node added in v1.3.16

type Node struct {
	Snode     *cluster.Snode `json:"snode"`
	Tracker   copyTracker    `json:"tracker"`
	TargetCDF fs.TargetCDF   `json:"capacity"`
}

REST API

type NodeStatus added in v1.3.16

type NodeStatus struct {
	Node
	RebSnap *cluster.Snap `json:"rebalance_snap,omitempty"`
	// assorted props
	Status         string         `json:"status"`
	DeploymentType string         `json:"deployment"`
	Version        string         `json:"ais_version"`  // major.minor.build
	BuildTime      string         `json:"build_time"`   // YYYY-MM-DD HH:MM:SS-TZ
	K8sPodName     string         `json:"k8s_pod_name"` // (via ais-k8s/operator `MY_POD` env var)
	MemCPUInfo     apc.MemCPUInfo `json:"sys_info"`
	SmapVersion    int64          `json:"smap_version,string"`
}

(includes stats.Node and more; NOTE: direct API call w/ no proxying)

type Prunner

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

func (*Prunner) Add

func (r *Prunner) Add(name string, val int64)

func (*Prunner) AddMany

func (r *Prunner) AddMany(nvs ...cos.NamedVal64)

func (*Prunner) Collect

func (r *Prunner) Collect(ch chan<- prometheus.Metric)

func (*Prunner) Describe

func (r *Prunner) Describe(ch chan<- *prometheus.Desc)

func (*Prunner) Get

func (r *Prunner) Get(name string) (val int64)

func (*Prunner) GetMetricNames added in v1.3.16

func (r *Prunner) GetMetricNames() cos.StrKVs

func (*Prunner) GetStats added in v1.3.16

func (r *Prunner) GetStats() *Node

func (*Prunner) Inc added in v1.3.16

func (r *Prunner) Inc(name string)

func (*Prunner) IncErr added in v1.3.16

func (r *Prunner) IncErr(metric string)

func (*Prunner) Init

func (r *Prunner) Init(p cluster.Node) *atomic.Bool

All stats that proxy currently has are CoreStats which are registered at startup

func (*Prunner) IsPrometheus

func (r *Prunner) IsPrometheus() bool

func (*Prunner) Name

func (r *Prunner) Name() string

func (*Prunner) RegMetrics

func (r *Prunner) RegMetrics(node *cluster.Snode)

NOTE: have only common metrics (see regCommon()) - init only the Prometheus part if used

func (*Prunner) ResetStats added in v1.3.16

func (r *Prunner) ResetStats(errorsOnly bool)

func (*Prunner) Run

func (r *Prunner) Run() error

func (*Prunner) StartedUp

func (r *Prunner) StartedUp() bool

func (*Prunner) Stop

func (r *Prunner) Stop(err error)

type Tracker

type Tracker interface {
	cos.StatsUpdater

	StartedUp() bool
	IsPrometheus() bool

	IncErr(metric string)

	GetStats() *Node
	ResetStats(errorsOnly bool)
	GetMetricNames() cos.StrKVs // (name, kind) pairs

	RegMetrics(node *cluster.Snode) // + init Prometheus, if configured
}

type Trunner

type Trunner struct {
	TargetCDF fs.TargetCDF `json:"cdf"`
	// contains filtered or unexported fields
}

func NewTrunner added in v1.3.16

func NewTrunner(t cluster.NodeMemCap) *Trunner

func (*Trunner) Add

func (r *Trunner) Add(name string, val int64)

func (*Trunner) AddMany

func (r *Trunner) AddMany(nvs ...cos.NamedVal64)

func (*Trunner) Collect

func (r *Trunner) Collect(ch chan<- prometheus.Metric)

func (*Trunner) Describe

func (r *Trunner) Describe(ch chan<- *prometheus.Desc)

func (*Trunner) Get

func (r *Trunner) Get(name string) (val int64)

func (*Trunner) GetMetricNames added in v1.3.16

func (r *Trunner) GetMetricNames() cos.StrKVs

func (*Trunner) GetStats added in v1.3.16

func (r *Trunner) GetStats() (ds *Node)

func (*Trunner) Inc added in v1.3.16

func (r *Trunner) Inc(name string)

func (*Trunner) IncErr added in v1.3.16

func (r *Trunner) IncErr(metric string)

func (*Trunner) Init

func (r *Trunner) Init(t cluster.Target) *atomic.Bool

func (*Trunner) InitCDF added in v1.3.16

func (r *Trunner) InitCDF() error

func (*Trunner) IsPrometheus

func (r *Trunner) IsPrometheus() bool

func (*Trunner) Name

func (r *Trunner) Name() string

func (*Trunner) RegDiskMetrics

func (r *Trunner) RegDiskMetrics(disk string)

func (*Trunner) RegMetrics

func (r *Trunner) RegMetrics(node *cluster.Snode)

func (*Trunner) ResetStats added in v1.3.16

func (r *Trunner) ResetStats(errorsOnly bool)

func (*Trunner) Run

func (r *Trunner) Run() error

func (*Trunner) Standby

func (r *Trunner) Standby(v bool)

func (*Trunner) StartedUp

func (r *Trunner) StartedUp() bool

func (*Trunner) Stop

func (r *Trunner) Stop(err error)

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