metrics

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Subsystem is prometheus subsystem name.
	Subsystem = "local"
)

Variables

View Source
var (
	// Allocatable size of VG.
	VolumeGroupTotal = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"vgname":   "",
	}).SubScope(Subsystem).Gauge("volume_group_total")

	//Used size of VG.
	VolumeGroupUsedByLocal = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"vgname":   "",
	}).SubScope(Subsystem).Gauge("volume_group_used")

	//Total size of MountPoint.
	MountPointTotal = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
		"type":     "",
	}).SubScope(Subsystem).Gauge("mount_point_total")

	//Available size of MountPoint.
	MountPointAvailable = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
		"type":     "",
	}).SubScope(Subsystem).Gauge("mount_point_available")

	//Is MountPoint Bind.
	MountPointBind = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
	}).SubScope(Subsystem).Gauge("mount_point_bind")

	//Total size of Device.
	DeviceTotal = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
		"type":     "",
	}).SubScope(Subsystem).Gauge("device_total")

	//Available size of Device.
	DeviceAvailable = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
		"type":     "",
	}).SubScope(Subsystem).Gauge("device_available")

	//Is Device Bind.
	DeviceBind = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
		"name":     "",
	}).SubScope(Subsystem).Gauge("device_bind")

	//allocated number.
	AllocatedNum = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename": "",
	}).SubScope(Subsystem).Gauge("allocated_num")

	// storage_name
	// LVM:         VG name
	// MountPoint:  mount path
	// Device:      device path
	LocalPV = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename":     "",
		"pv_name":      "",
		"pv_type":      "",
		"pvc_name":     "",
		"pvc_ns":       "",
		"status":       "",
		"storage_name": "",
	}).SubScope(Subsystem).Gauge("local_pv")

	//pod inline volume.
	InlineVolume = DefaultTallyScope.Scope.Tagged(map[string]string{
		"nodename":      "",
		"pod_namespace": "",
		"pod_name":      "",
		"vgname":        "",
		"volume_name":   "",
	}).SubScope(Subsystem).Gauge("inline_volume")
)
View Source
var (
	ErrMetricsInitRegistryError = errors.New("metrics: can not init metrics registry")
	ErrMetricsDoNotExist        = errors.New("metrics: metrics do not exists")
	ErrMetricsIsDuplicated      = errors.New("metrics: metric is duplicated")
)
View Source
var DefaultTallyBuckets = tally.ValueBuckets{.01, .05, .1, .2, .5, .8, .9, 1, 5, 10, 15, 30, 60, 90, 120}

Functions

func DefaultRegistry

func DefaultRegistry() prometheus.Registerer

默认prometheus.DefaultRegisterer, 没有特殊需要,不用使用NewRegisterer

Types

type TallyScope

type TallyScope struct {
	Reporter promreporter.Reporter
	Scope    tally.Scope
	Closer   io.Closer
}

metrics 发布器

var DefaultTallyScope *TallyScope

TODO 默认metrics Scope

func NewTallyScope

func NewTallyScope(prefix string, tags map[string]string, interval time.Duration) *TallyScope

创建

func (*TallyScope) Destroy

func (t *TallyScope) Destroy() error

进程失败销毁

Jump to

Keyboard shortcuts

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