Documentation
¶
Index ¶
Constants ¶
const ( // MetricGroup name format for each user. UserMetricGroupFormat = "user - %s" UserMetricInBytes = "InBytes" UserMetricOutBytes = "OutBytes" )
Variables ¶
var ( // Max number of connections ever reached. MaxConn = RegisterMetric("connections", "MaxConn") // Accumulated active open connections. ActiveOpens = RegisterMetric("connections", "ActiveOpens") // Accumulated passive open connections. PassiveOpens = RegisterMetric("connections", "PassiveOpens") // Current number of established connections. CurrEstablished = RegisterMetric("connections", "CurrEstablished") // Number of bytes receive from proxy connections. InBytes = RegisterMetric("traffic", "InBytes") // Number of bytes send to proxy connections. OutBytes = RegisterMetric("traffic", "OutBytes") // Number of padding bytes send to proxy connections. OutPaddingBytes = RegisterMetric("traffic", "OutPaddingBytes") )
Functions ¶
func SetLoggingDuration ¶
Set the metrics logging time duration.
Types ¶
type Metric ¶ added in v1.9.0
type Metric struct {
// contains filtered or unexported fields
}
Metric holds a named int64 value. int64 is the only supported metric value type.
func RegisterMetric ¶ added in v1.9.0
RegisterMetric registers a new metric. The caller should not take the ownership of the returned pointer. If the same metric is registered multiple times, the pointer to the first object is returned.
type MetricGroup ¶ added in v1.9.0
type MetricGroup struct {
// contains filtered or unexported fields
}
MetricGroup holds a list of metric under the same group.
func GetMetricGroupByName ¶ added in v1.9.0
func GetMetricGroupByName(groupName string) *MetricGroup
GetMetricGroupByName returns the MetricGroup by name. It returns nil if the MetricGroup is not found.
func (*MetricGroup) DisableLogging ¶ added in v1.9.0
func (g *MetricGroup) DisableLogging()
DisableLogging disables logging of this MetricGroup.
func (*MetricGroup) EnableLogging ¶ added in v1.9.0
func (g *MetricGroup) EnableLogging()
EnableLogging enables logging of this MetricGroup.
func (*MetricGroup) IsLoggingEnabled ¶ added in v1.9.0
func (g *MetricGroup) IsLoggingEnabled() bool
IsLoggingEnabled returns if logging is enabled in this MetricGroup.
func (*MetricGroup) NewLogFields ¶ added in v1.9.0
func (g *MetricGroup) NewLogFields() log.Fields
NewLogFields creates log fields from the MetricGroup.
func (*MetricGroup) NewLogMsg ¶ added in v1.9.0
func (g *MetricGroup) NewLogMsg() string
NewLogMsg creates a base log message without fields from the MetricGroup.
type MetricGroupList ¶ added in v1.9.0
type MetricGroupList []*MetricGroup
MetricGroupList is a list of MetricGroup.
func (MetricGroupList) Append ¶ added in v1.9.0
func (l MetricGroupList) Append(group *MetricGroup) MetricGroupList
Append adds a new MetricGroup to the end of list.
func (MetricGroupList) Len ¶ added in v1.9.0
func (l MetricGroupList) Len() int
Len implements sort.Interface.
func (MetricGroupList) Less ¶ added in v1.9.0
func (l MetricGroupList) Less(i, j int) bool
Less implements sort.Interface.
func (MetricGroupList) Swap ¶ added in v1.9.0
func (l MetricGroupList) Swap(i, j int)
Swap implements sort.Interface.