Documentation ¶
Index ¶
Constants ¶
View Source
const ( METRIC_NS = "ehco" METRIC_SUBSYSTEM_TRAFFIC = "traffic" METRIC_SUBSYSTEM_PING = "ping" METRIC_LABEL_REMOTE = "remote" METRIC_LABEL_CONN_FLOW = "flow" METRIC_CONN_FLOW_WRITE = "write" METRIC_CONN_FLOW_READ = "read" METRIC_LABEL_CONN_TYPE = "type" METRIC_CONN_TYPE_TCP = "tcp" METRIC_CONN_TYPE_UDP = "udp" EhcoAliveStateInit = 0 EhcoAliveStateRunning = 1 )
Variables ¶
View Source
var ( PingResponseDurationSeconds = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: METRIC_NS, Subsystem: METRIC_SUBSYSTEM_PING, Name: "response_duration_seconds", Help: "A histogram of latencies for ping responses.", Buckets: pingBuckets, ConstLabels: ConstLabels, }, pingLabelNames, ) PingRequestTotal = prometheus.NewDesc( prometheus.BuildFQName(METRIC_NS, METRIC_SUBSYSTEM_PING, "requests_total"), "Number of ping requests sent", pingLabelNames, ConstLabels, ) )
View Source
var (
Hostname, _ = os.Hostname()
ConstLabels = map[string]string{
"hostname": Hostname,
}
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{METRIC_LABEL_REMOTE, METRIC_LABEL_CONN_TYPE})
NetWorkTransmitBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: METRIC_NS,
Subsystem: METRIC_SUBSYSTEM_TRAFFIC,
Name: "network_transmit_bytes",
Help: "传输流量总量bytes",
ConstLabels: ConstLabels,
}, []string{METRIC_LABEL_REMOTE, METRIC_LABEL_CONN_TYPE, METRIC_LABEL_CONN_FLOW})
HandShakeDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Subsystem: METRIC_SUBSYSTEM_TRAFFIC,
Namespace: METRIC_NS,
Name: "handshake_duration",
Help: "握手时间ms",
ConstLabels: ConstLabels,
}, []string{METRIC_LABEL_REMOTE})
)
Functions ¶
func AttachProfiler ¶ added in v1.0.1
func MakeIndexF ¶ added in v1.1.2
func MakeIndexF() http.HandlerFunc
func StartWebServer ¶ added in v1.0.1
Types ¶
type PingGroup ¶ added in v1.0.3
func NewPingGroup ¶ added in v1.0.3
func (*PingGroup) Collect ¶ added in v1.0.3
func (pg *PingGroup) Collect(ch chan<- prometheus.Metric)
func (*PingGroup) Describe ¶ added in v1.0.3
func (pg *PingGroup) Describe(ch chan<- *prometheus.Desc)
Click to show internal directories.
Click to hide internal directories.