metrics

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFlowCounter added in v0.3.8

func SetFlowCounter(c FlowCounter)

Types

type EmptyMetrics added in v0.3.8

type EmptyMetrics struct{}

func (*EmptyMetrics) AddBlockConnection added in v0.3.8

func (m *EmptyMetrics) AddBlockConnection(addr string)

func (*EmptyMetrics) AddConnection added in v0.3.8

func (m *EmptyMetrics) AddConnection(addr string)

func (*EmptyMetrics) AddDNSProcess added in v0.3.8

func (m *EmptyMetrics) AddDNSProcess(domain string)

func (*EmptyMetrics) AddFailedDNS added in v0.3.8

func (m *EmptyMetrics) AddFailedDNS(domain string, rcode dnsmessage.RCode, t dnsmessage.Type)

func (*EmptyMetrics) AddReceiveUDPDroppedPacket added in v0.3.8

func (m *EmptyMetrics) AddReceiveUDPDroppedPacket()

func (*EmptyMetrics) AddReceiveUDPPacket added in v0.3.8

func (m *EmptyMetrics) AddReceiveUDPPacket()

func (*EmptyMetrics) AddReceiveUDPPacketSize added in v0.3.8

func (m *EmptyMetrics) AddReceiveUDPPacketSize(size int)

func (*EmptyMetrics) AddSendUDPDroppedPacket added in v0.3.8

func (m *EmptyMetrics) AddSendUDPDroppedPacket()

func (*EmptyMetrics) AddSendUDPPacket added in v0.3.8

func (m *EmptyMetrics) AddSendUDPPacket()

func (*EmptyMetrics) AddSendUDPPacketSize added in v0.3.8

func (m *EmptyMetrics) AddSendUDPPacketSize(size int)

func (*EmptyMetrics) AddStreamConnectDuration added in v0.3.8

func (m *EmptyMetrics) AddStreamConnectDuration(t float64)

func (*EmptyMetrics) AddTCPDialFailed added in v0.3.8

func (m *EmptyMetrics) AddTCPDialFailed(addr string)

func (*EmptyMetrics) RemoveConnection added in v0.3.8

func (m *EmptyMetrics) RemoveConnection(n int)

type FlowCounter added in v0.3.8

type FlowCounter interface {
	LoadRunningDownload() uint64
	LoadRunningUpload() uint64
}

type Metrics

type Metrics interface {
	AddReceiveUDPPacket()
	AddSendUDPPacket()
	AddReceiveUDPDroppedPacket()
	AddSendUDPDroppedPacket()
	AddReceiveUDPPacketSize(size int)
	AddSendUDPPacketSize(size int)
	AddConnection(addr string)
	AddBlockConnection(addr string)
	RemoveConnection(n int)
	AddStreamConnectDuration(t float64)
	AddDNSProcess(domain string)
	AddFailedDNS(domain string, rcode dnsmessage.RCode, t dnsmessage.Type)
	AddTCPDialFailed(addr string)
}
var Counter Metrics = &EmptyMetrics{}

type Prometheus

type Prometheus struct {
	TotalReceiveUDPPacket        prometheus.Counter
	TotalSendUDPPacket           prometheus.Counter
	TotalReceiveUDPDroppedPacket prometheus.Counter
	TotalSendUDPDroppedPacket    prometheus.Counter
	UDPReceivePacketSize         prometheus.Histogram
	UDPSendPacketSize            prometheus.Histogram

	TotalConnection      prometheus.Counter
	CurrentConnection    prometheus.Gauge
	TotalBlockConnection prometheus.Counter

	StreamConnectDurationSeconds prometheus.Histogram
	StreamConnectSummarySeconds  prometheus.Summary

	DNSProcessTotal prometheus.Counter
	FiledDNSTotal   prometheus.Counter

	TCPDialFailedTotal prometheus.Counter
}

func NewPrometheus

func NewPrometheus() *Prometheus

func (*Prometheus) AddBlockConnection added in v0.3.7

func (p *Prometheus) AddBlockConnection(addr string)

func (*Prometheus) AddConnection

func (p *Prometheus) AddConnection(addr string)

func (*Prometheus) AddDNSProcess

func (p *Prometheus) AddDNSProcess(domain string)

func (*Prometheus) AddFailedDNS

func (p *Prometheus) AddFailedDNS(domain string, rcode dnsmessage.RCode, t dnsmessage.Type)

func (*Prometheus) AddReceiveUDPDroppedPacket added in v0.3.8

func (p *Prometheus) AddReceiveUDPDroppedPacket()

func (*Prometheus) AddReceiveUDPPacket

func (p *Prometheus) AddReceiveUDPPacket()

func (*Prometheus) AddReceiveUDPPacketSize added in v0.3.8

func (p *Prometheus) AddReceiveUDPPacketSize(size int)

func (*Prometheus) AddSendUDPDroppedPacket added in v0.3.8

func (p *Prometheus) AddSendUDPDroppedPacket()

func (*Prometheus) AddSendUDPPacket

func (p *Prometheus) AddSendUDPPacket()

func (*Prometheus) AddSendUDPPacketSize added in v0.3.8

func (p *Prometheus) AddSendUDPPacketSize(size int)

func (*Prometheus) AddStreamConnectDuration

func (p *Prometheus) AddStreamConnectDuration(t float64)

func (*Prometheus) AddTCPDialFailed

func (p *Prometheus) AddTCPDialFailed(addr string)

func (*Prometheus) RemoveConnection

func (p *Prometheus) RemoveConnection(n int)

Jump to

Keyboard shortcuts

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