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-2024, 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-2024, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- func IsErrMetric(name string) bool
- type Cluster
- type ClusterRaw
- type Node
- type NodeStatus
- type NodeStatusV322
- type NodeV322
- type Prunner
- func (r *Prunner) Add(name string, val int64)
- func (r *Prunner) AddMany(nvs ...cos.NamedVal64)
- func (r *Prunner) Collect(ch chan<- prometheus.Metric)
- func (r *Prunner) Describe(ch chan<- *prometheus.Desc)
- func (r *Prunner) Flag(name string, set, clr cos.NodeStateFlags)
- func (r *Prunner) Get(name string) (val int64)
- func (r *Prunner) GetMetricNames() cos.StrKVs
- func (r *Prunner) GetStats() *Node
- func (r *Prunner) GetStatsV322() (out *NodeV322)
- func (r *Prunner) Inc(name string)
- func (r *Prunner) IncErr(metric string)
- func (r *Prunner) Init(p core.Node) *atomic.Bool
- func (r *Prunner) IsPrometheus() bool
- func (r *Prunner) Name() string
- func (r *Prunner) RegMetrics(node *meta.Snode)
- func (r *Prunner) ResetStats(errorsOnly bool)
- func (r *Prunner) Run() error
- func (r *Prunner) StartedUp() bool
- func (r *Prunner) Stop(err error)
- type Tracker
- type Trunner
- func (r *Trunner) Add(name string, val int64)
- func (r *Trunner) AddMany(nvs ...cos.NamedVal64)
- func (r *Trunner) Collect(ch chan<- prometheus.Metric)
- func (r *Trunner) Describe(ch chan<- *prometheus.Desc)
- func (r *Trunner) Flag(name string, set, clr cos.NodeStateFlags)
- func (r *Trunner) Get(name string) (val int64)
- func (r *Trunner) GetMetricNames() cos.StrKVs
- func (r *Trunner) GetStats() (ds *Node)
- func (r *Trunner) GetStatsV322() (out *NodeV322)
- func (r *Trunner) Inc(name string)
- func (r *Trunner) IncErr(metric string)
- func (r *Trunner) Init(t core.Target) *atomic.Bool
- func (r *Trunner) InitCDF() error
- func (r *Trunner) IsPrometheus() bool
- func (r *Trunner) Name() string
- func (r *Trunner) RegDiskMetrics(snode *meta.Snode, disk string)
- func (r *Trunner) RegMetrics(snode *meta.Snode)
- func (r *Trunner) ResetStats(errorsOnly bool)
- func (r *Trunner) Run() error
- func (r *Trunner) Standby(v bool)
- func (r *Trunner) StartedUp() bool
- func (r *Trunner) Stop(err error)
Constants ¶
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
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" // GET(object) count = (cold + warm) 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" // KindGauge, cos.NodeStateFlags enum NodeStateFlags = "state.flags" )
metrics
const ( // NOTE semantics: // - counts all instances when remote GET is followed by storing of the new object (version) locally // - does _not_ count assorted calls to `GetObjReader` (e.g., via tcb/tco -> LDP.Reader) 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" // errors ErrCksumCount = "err.cksum.n" ErrCksumSize = "err.cksum.size" ErrMetadataCount = "err.md.n" ErrIOCount = "err.io.n" // KindLatency PutLatency = "put.ns" AppendLatency = "append.ns" GetRedirLatency = "get.redir.ns" PutRedirLatency = "put.redir.ns" DownloadLatency = "dl.ns" // (read remote, write local) latency (and note that cold-GET's "pure" // transmit-response latency = GetLatency - GetColdRwLatency) GetColdRwLatency = "get.cold.rw.ns" // Dsort DsortCreationReqCount = "dsort.creation.req.n" DsortCreationRespCount = "dsort.creation.resp.n" DsortCreationRespLatency = "dsort.creation.resp.ns" DsortExtractShardDskCnt = "dsort.extract.shard.dsk.n" DsortExtractShardMemCnt = "dsort.extract.shard.mem.n" DsortExtractShardSize = "dsort.extract.shard.size" // uncompressed // 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" // core RemoteDeletedDelCount = core.RemoteDeletedDelCount // compare w/ common `DeleteCount` LcacheCollisionCount = core.LcacheCollisionCount LcacheEvictedCount = core.LcacheEvictedCount LcacheFlushColdCount = core.LcacheFlushColdCount )
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
Types ¶
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 *meta.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
Cluster cos.NodeStateInfo
RebSnap *core.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)
Reserved1 string `json:"reserved1,omitempty"`
Reserved2 string `json:"reserved2,omitempty"`
MemCPUInfo apc.MemCPUInfo `json:"sys_info"`
SmapVersion int64 `json:"smap_version,string"`
Reserved3 int64 `json:"reserved3,omitempty"`
Reserved4 int64 `json:"reserved4,omitempty"`
}
(includes stats.Node and more; NOTE: direct API call w/ no proxying)
type NodeStatusV322 ¶ added in v1.3.23
type NodeStatusV322 struct {
NodeV322
RebSnap *core.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"`
}
[backward compatibility]: includes v3.22 cdf* structures
type NodeV322 ¶ added in v1.3.23
type NodeV322 struct {
Snode *meta.Snode `json:"snode"`
Tracker copyTracker `json:"tracker"`
TargetCDF fs.TargetCDFv322 `json:"capacity"`
}
[backward compatibility]: includes v3.22 cdf* structures
type Prunner ¶
type Prunner struct {
// contains filtered or unexported fields
}
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) Flag ¶ added in v1.3.23
func (r *Prunner) Flag(name string, set, clr cos.NodeStateFlags)
func (*Prunner) GetMetricNames ¶ added in v1.3.16
func (*Prunner) GetStatsV322 ¶ added in v1.3.23
func (r *Prunner) GetStatsV322() (out *NodeV322)
func (*Prunner) Init ¶
All stats that proxy currently has are CoreStats which are registered at startup
func (*Prunner) IsPrometheus ¶
func (r *Prunner) IsPrometheus() bool
func (*Prunner) RegMetrics ¶
have only common metrics - init only the Prometheus part if enabled
func (*Prunner) ResetStats ¶ added in v1.3.16
func (r *Prunner) ResetStats(errorsOnly bool)
type Tracker ¶
type Tracker interface {
cos.StatsUpdater
StartedUp() bool
IsPrometheus() bool
IncErr(metric string)
GetStats() *Node
GetStatsV322() *NodeV322 // [backward compatibility]
ResetStats(errorsOnly bool)
GetMetricNames() cos.StrKVs // (name, kind) pairs
RegMetrics(node *meta.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 core.NodeCapacity) *Trunner
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) Flag ¶ added in v1.3.23
func (r *Trunner) Flag(name string, set, clr cos.NodeStateFlags)
func (*Trunner) GetMetricNames ¶ added in v1.3.16
func (*Trunner) GetStatsV322 ¶ added in v1.3.23
[backward compatibility] v3.22 and prior
func (*Trunner) IsPrometheus ¶
func (r *Trunner) IsPrometheus() bool
func (*Trunner) RegMetrics ¶
target-specific metrics, in addition to common and already added via regCommon()
func (*Trunner) ResetStats ¶ added in v1.3.16
func (r *Trunner) ResetStats(errorsOnly bool)