Documentation
¶
Index ¶
- Variables
- func NewPrometheusHandler(registry *Registry) http.Handler
- type Channel
- type Collector
- type ConsoleReporter
- type Metrics
- func (m *Metrics) GetServers() []TunnelMetrics
- func (m *Metrics) GetTraffics(id string) (*TunnelTraffic, bool)
- func (m *Metrics) PrometheusHandler() http.Handler
- func (m *Metrics) PutServer(server TunnelMetrics) *TunnelTraffic
- func (m *Metrics) PutTraffics(traffic *TunnelTraffic)
- func (m *Metrics) RemoveServer(server TunnelMetrics)
- func (m *Metrics) Snapshot() []TunnelTrafficSnapshot
- type PrometheusExporter
- type Registry
- func (r *Registry) GetTraffic(id string) (*TunnelTraffic, bool)
- func (r *Registry) Register(server TunnelMetrics) *TunnelTraffic
- func (r *Registry) Snapshot() []TunnelTrafficSnapshot
- func (r *Registry) SweepExpired() []string
- func (r *Registry) Touch(id string)
- func (r *Registry) Unregister(id string)
- type TunnelMetrics
- type TunnelTraffic
- func (ts *TunnelTraffic) AddInBytes(bytes int)
- func (ts *TunnelTraffic) AddOutBytes(bytes int)
- func (ts *TunnelTraffic) InRateBps() float64
- func (ts *TunnelTraffic) LatencyMs() float64
- func (ts *TunnelTraffic) Name() string
- func (ts *TunnelTraffic) ObserveLatency(d time.Duration)
- func (ts *TunnelTraffic) OutRateBps() float64
- func (ts *TunnelTraffic) Port() int
- func (ts *TunnelTraffic) Rate() (float64, float64)
- func (ts *TunnelTraffic) Sum() (in uint64, out uint64)
- type TunnelTrafficSnapshot
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = NewCollector(NewRegistry(1*time.Hour, 5*time.Second, 10*time.Minute))
View Source
var M = newMetrics()
Functions ¶
func NewPrometheusHandler ¶ added in v0.4.0
Types ¶
type Channel ¶
func NewMetricsChannel ¶
func NewMetricsChannel(src transport.Channel, traffic *TunnelTraffic) *Channel
type Collector ¶ added in v0.4.0
type Collector struct {
// contains filtered or unexported fields
}
func NewCollector ¶ added in v0.4.0
func (*Collector) GetTraffic ¶ added in v0.4.0
func (c *Collector) GetTraffic(id string) (*TunnelTraffic, bool)
func (*Collector) Register ¶ added in v0.4.0
func (c *Collector) Register(server TunnelMetrics) *TunnelTraffic
func (*Collector) Snapshot ¶ added in v0.4.0
func (c *Collector) Snapshot() []TunnelTrafficSnapshot
func (*Collector) Unregister ¶ added in v0.4.0
type ConsoleReporter ¶ added in v0.4.0
type ConsoleReporter struct {
// contains filtered or unexported fields
}
func NewConsoleReporter ¶ added in v0.4.0
func NewConsoleReporter(registry *Registry, interval time.Duration) *ConsoleReporter
func (*ConsoleReporter) Start ¶ added in v0.4.0
func (r *ConsoleReporter) Start()
func (*ConsoleReporter) Stop ¶ added in v0.4.0
func (r *ConsoleReporter) Stop()
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func (*Metrics) GetServers ¶
func (m *Metrics) GetServers() []TunnelMetrics
func (*Metrics) GetTraffics ¶
func (m *Metrics) GetTraffics(id string) (*TunnelTraffic, bool)
func (*Metrics) PrometheusHandler ¶ added in v0.4.0
func (*Metrics) PutServer ¶
func (m *Metrics) PutServer(server TunnelMetrics) *TunnelTraffic
func (*Metrics) PutTraffics ¶
func (m *Metrics) PutTraffics(traffic *TunnelTraffic)
func (*Metrics) RemoveServer ¶
func (m *Metrics) RemoveServer(server TunnelMetrics)
func (*Metrics) Snapshot ¶ added in v0.4.0
func (m *Metrics) Snapshot() []TunnelTrafficSnapshot
type PrometheusExporter ¶ added in v0.4.0
type PrometheusExporter struct {
// contains filtered or unexported fields
}
func NewPrometheusExporter ¶ added in v0.4.0
func NewPrometheusExporter(registry *Registry) *PrometheusExporter
func (*PrometheusExporter) Collect ¶ added in v0.4.0
func (e *PrometheusExporter) Collect(ch chan<- prometheus.Metric)
func (*PrometheusExporter) Describe ¶ added in v0.4.0
func (e *PrometheusExporter) Describe(ch chan<- *prometheus.Desc)
type Registry ¶ added in v0.4.0
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶ added in v0.4.0
func (*Registry) GetTraffic ¶ added in v0.4.0
func (r *Registry) GetTraffic(id string) (*TunnelTraffic, bool)
func (*Registry) Register ¶ added in v0.4.0
func (r *Registry) Register(server TunnelMetrics) *TunnelTraffic
func (*Registry) Snapshot ¶ added in v0.4.0
func (r *Registry) Snapshot() []TunnelTrafficSnapshot
func (*Registry) SweepExpired ¶ added in v0.4.0
func (*Registry) Unregister ¶ added in v0.4.0
type TunnelMetrics ¶
type TunnelTraffic ¶
type TunnelTraffic struct {
Id string
// contains filtered or unexported fields
}
func NewTunnelTraffic ¶
func (*TunnelTraffic) AddInBytes ¶
func (ts *TunnelTraffic) AddInBytes(bytes int)
func (*TunnelTraffic) AddOutBytes ¶
func (ts *TunnelTraffic) AddOutBytes(bytes int)
func (*TunnelTraffic) InRateBps ¶ added in v0.4.0
func (ts *TunnelTraffic) InRateBps() float64
func (*TunnelTraffic) LatencyMs ¶ added in v0.4.0
func (ts *TunnelTraffic) LatencyMs() float64
func (*TunnelTraffic) Name ¶ added in v0.4.0
func (ts *TunnelTraffic) Name() string
func (*TunnelTraffic) ObserveLatency ¶ added in v0.4.0
func (ts *TunnelTraffic) ObserveLatency(d time.Duration)
func (*TunnelTraffic) OutRateBps ¶ added in v0.4.0
func (ts *TunnelTraffic) OutRateBps() float64
func (*TunnelTraffic) Port ¶ added in v0.4.0
func (ts *TunnelTraffic) Port() int
func (*TunnelTraffic) Rate ¶ added in v0.4.0
func (ts *TunnelTraffic) Rate() (float64, float64)
func (*TunnelTraffic) Sum ¶
func (ts *TunnelTraffic) Sum() (in uint64, out uint64)
type TunnelTrafficSnapshot ¶ added in v0.4.0
type TunnelTrafficSnapshot struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Port int `json:"port"`
Connections int `json:"connections"`
Clients int `json:"clients"`
Runtime time.Time `json:"runtime"`
LastSeen time.Time `json:"last_seen"`
AgeSeconds float64 `json:"age_seconds"`
InBytes uint64 `json:"in_bytes"`
OutBytes uint64 `json:"out_bytes"`
InRateBps float64 `json:"in_rate_bps"`
OutRateBps float64 `json:"out_rate_bps"`
LatencyMs float64 `json:"latency_ms"`
}
Click to show internal directories.
Click to hide internal directories.