Skip to content

Commit faf584e

Browse files
committed
metric: fix statistics error
1 parent ba6afd5 commit faf584e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

server/metric.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ type ServerStatistics struct {
3232
TotalTrafficOut metric.DateCounter
3333
CurConns metric.Counter
3434

35-
ClientCounts metric.Counter
35+
// counter for clients
36+
ClientCounts metric.Counter
37+
38+
// counter for proxy types
3639
ProxyTypeCounts map[string]metric.Counter
3740

41+
// statistics for different proxies
42+
// key is proxy name
3843
ProxyStatistics map[string]*ProxyStatistics
3944

4045
mu sync.Mutex
@@ -84,7 +89,7 @@ func StatsNewProxy(name string, proxyType string) {
8489
globalStats.ProxyTypeCounts[proxyType] = counter
8590

8691
proxyStats, ok := globalStats.ProxyStatistics[name]
87-
if !ok {
92+
if !(ok && proxyStats.ProxyType == proxyType) {
8893
proxyStats = &ProxyStatistics{
8994
ProxyType: proxyType,
9095
CurConns: metric.NewCounter(),

server/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func NewService() (svr *Service, err error) {
111111
err = fmt.Errorf("Create dashboard web server error, %v", err)
112112
return
113113
}
114+
log.Info("Dashboard listen on %s:%d", config.ServerCommonCfg.BindAddr, config.ServerCommonCfg.DashboardPort)
114115
}
115116
return
116117
}

0 commit comments

Comments
 (0)