metric

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DailyDataKeepDays   int = 7
	ServerMetricInfoMap map[string]*ServerMetric
)

Functions

func AddFlowIn

func AddFlowIn(proxyName string, value int64)

func AddFlowOut

func AddFlowOut(proxyName string, value int64)

func CloseConnection

func CloseConnection(proxyName string)

func OpenConnection

func OpenConnection(proxyName string)

func SetProxyInfo

func SetProxyInfo(proxyName string, proxyType, bindAddr string,
	useEncryption, useGzip, privilegeMode bool, customDomains []string,
	listenPort int64)

func SetStatus

func SetStatus(proxyName string, status int64)

Types

type DailyServerStats

type DailyServerStats struct {
	Time             string `json:"time"`
	FlowIn           int64  `json:"flow_in"`
	FlowOut          int64  `json:"flow_out"`
	TotalAcceptConns int64  `json:"total_accept_conns"`
}

func DealDailyData

func DealDailyData(dailyData []*DailyServerStats, fn DealFuncType) (newDailyData []*DailyServerStats)

type DealFuncType

type DealFuncType func(*DailyServerStats)

type ServerMetric

type ServerMetric struct {
	Name          string   `json:"name"`
	Type          string   `json:"type"`
	BindAddr      string   `json:"bind_addr"`
	ListenPort    int64    `json:"listen_port"`
	CustomDomains []string `json:"custom_domains"`
	Status        string   `json:"status"`
	UseEncryption bool     `json:"use_encryption"`
	UseGzip       bool     `json:"use_gzip"`
	PrivilegeMode bool     `json:"privilege_mode"`

	// statistics
	CurrentConns int64               `json:"current_conns"`
	Daily        []*DailyServerStats `json:"daily"`
	// contains filtered or unexported fields
}

func GetAllProxyMetrics

func GetAllProxyMetrics() []*ServerMetric

func GetProxyMetrics

func GetProxyMetrics(proxyName string) *ServerMetric

if proxyName isn't exist, return nil

type ServerMetricList

type ServerMetricList []*ServerMetric

for sort

func (ServerMetricList) Len

func (l ServerMetricList) Len() int

func (ServerMetricList) Less

func (l ServerMetricList) Less(i, j int) bool

func (ServerMetricList) Swap

func (l ServerMetricList) Swap(i, j int)

Jump to

Keyboard shortcuts

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