Просмотр исходного кода

Add comments for exported functions

tags/0.15^2
9seconds 7 лет назад
Родитель
Сommit
3aec9657d7
3 измененных файлов: 4 добавлений и 0 удалений
  1. 1
    0
      stats/channels.go
  2. 1
    0
      stats/init.go
  3. 2
    0
      stats/stats.go

+ 1
- 0
stats/channels.go Просмотреть файл

68
 	}
68
 	}
69
 }
69
 }
70
 
70
 
71
+// GetStats returns a snapshot of Stats instance.
71
 func GetStats() Stats {
72
 func GetStats() Stats {
72
 	rpcChan := make(chan Stats)
73
 	rpcChan := make(chan Stats)
73
 	statsChan <- rpcChan
74
 	statsChan <- rpcChan

+ 1
- 0
stats/init.go Просмотреть файл

6
 	"github.com/9seconds/mtg/config"
6
 	"github.com/9seconds/mtg/config"
7
 )
7
 )
8
 
8
 
9
+// Init initializes stats subsystem.
9
 func Init(conf *config.Config) error {
10
 func Init(conf *config.Config) error {
10
 	if conf.StatsD.Enabled {
11
 	if conf.StatsD.Enabled {
11
 		client, err := newStatsd(conf)
12
 		client, err := newStatsd(conf)

+ 2
- 0
stats/stats.go Просмотреть файл

89
 	return json.Marshal(value)
89
 	return json.Marshal(value)
90
 }
90
 }
91
 
91
 
92
+// Stats represents a statistics of the proxy.
92
 type Stats struct {
93
 type Stats struct {
93
 	URLs        config.IPURLs `json:"urls"`
94
 	URLs        config.IPURLs `json:"urls"`
94
 	Connections connections   `json:"connections"`
95
 	Connections connections   `json:"connections"`
165
 	s.Crashes++
166
 	s.Crashes++
166
 }
167
 }
167
 
168
 
169
+// NewStats creates a new instance of Stats structure.
168
 func NewStats(conf *config.Config) *Stats {
170
 func NewStats(conf *config.Config) *Stats {
169
 	return &Stats{
171
 	return &Stats{
170
 		URLs:   conf.GetURLs(),
172
 		URLs:   conf.GetURLs(),

Загрузка…
Отмена
Сохранить