Skip to content

Commit

Permalink
metric: fix statistics error
Browse files Browse the repository at this point in the history
  • Loading branch information
fatedier committed May 19, 2017
1 parent ba6afd5 commit faf584e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ type ServerStatistics struct {
TotalTrafficOut metric.DateCounter
CurConns metric.Counter

ClientCounts metric.Counter
// counter for clients
ClientCounts metric.Counter

// counter for proxy types
ProxyTypeCounts map[string]metric.Counter

// statistics for different proxies
// key is proxy name
ProxyStatistics map[string]*ProxyStatistics

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

proxyStats, ok := globalStats.ProxyStatistics[name]
if !ok {
if !(ok && proxyStats.ProxyType == proxyType) {
proxyStats = &ProxyStatistics{
ProxyType: proxyType,
CurConns: metric.NewCounter(),
Expand Down
1 change: 1 addition & 0 deletions server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func NewService() (svr *Service, err error) {
err = fmt.Errorf("Create dashboard web server error, %v", err)
return
}
log.Info("Dashboard listen on %s:%d", config.ServerCommonCfg.BindAddr, config.ServerCommonCfg.DashboardPort)
}
return
}
Expand Down

0 comments on commit faf584e

Please sign in to comment.