metrics

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METRIC_NS                = "ehco"
	METRIC_SUBSYSTEM_TRAFFIC = "traffic"
	METRIC_SUBSYSTEM_PING    = "ping"

	METRIC_CONN_TYPE_TCP = "tcp"
	METRIC_CONN_TYPE_UDP = "udp"
	METRIC_FLOW_READ     = "read"
	METRIC_FLOW_WRITE    = "write"

	EhcoAliveStateInit    = 0
	EhcoAliveStateRunning = 1
)

Variables

View Source
var (
	Hostname, _ = os.Hostname()
	ConstLabels = map[string]string{
		"ehco_runner_hostname": Hostname,
	}
)
View Source
var (
	EhcoAlive = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace:   METRIC_NS,
		Subsystem:   "",
		Name:        "alive_state",
		Help:        "ehco 存活状态",
		ConstLabels: ConstLabels,
	})

	CurConnectionCount = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace:   METRIC_NS,
		Subsystem:   METRIC_SUBSYSTEM_TRAFFIC,
		Name:        "current_connection_count",
		Help:        "当前链接数",
		ConstLabels: ConstLabels,
	}, []string{"label", "conn_type", "remote"})

	HandShakeDurationMilliseconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Buckets:     msBuckets,
		Subsystem:   METRIC_SUBSYSTEM_TRAFFIC,
		Namespace:   METRIC_NS,
		Name:        "handshake_duration_milliseconds",
		Help:        "握手时间ms",
		ConstLabels: ConstLabels,
	}, []string{"label", "conn_type", "remote"})

	NetWorkTransmitBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace:   METRIC_NS,
		Subsystem:   METRIC_SUBSYSTEM_TRAFFIC,
		Name:        "network_transmit_bytes",
		Help:        "传输流量总量bytes",
		ConstLabels: ConstLabels,
	}, []string{"label", "conn_type", "flow", "remote"})
)

traffic metrics

View Source
var (
	PingResponseDurationMilliseconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace:   METRIC_NS,
			Subsystem:   METRIC_SUBSYSTEM_PING,
			Name:        "response_duration_milliseconds",
			Help:        "A histogram of latencies for ping responses.",
			Buckets:     msBuckets,
			ConstLabels: ConstLabels,
		},
		[]string{"label", "remote", "ip"},
	)
)

ping metrics

Functions

func RegisterEhcoMetrics

func RegisterEhcoMetrics(cfg *config.Config) error

func RegisterNodeExporterMetrics

func RegisterNodeExporterMetrics(cfg *config.Config) error

Types

type PingGroup

type PingGroup struct {
	Pingers []*ping.Pinger
	// contains filtered or unexported fields
}

func NewPingGroup

func NewPingGroup(cfg *config.Config) *PingGroup

func (*PingGroup) Run

func (pg *PingGroup) Run()

Jump to

Keyboard shortcuts

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