Merge pull request #7193 from influxdata/2016-08-23-fix-panic-monitor-service
Fix "nil map" panic in statistics collection.pull/7203/head
commit
3ecc913c88
|
@ -5,3 +5,11 @@ type Statistic struct {
|
|||
Tags map[string]string `json:"tags"`
|
||||
Values map[string]interface{} `json:"values"`
|
||||
}
|
||||
|
||||
func NewStatistic(name string) Statistic {
|
||||
return Statistic{
|
||||
Name: name,
|
||||
Tags: make(map[string]string),
|
||||
Values: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,9 +210,7 @@ func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error) {
|
|||
}
|
||||
|
||||
statistic := &Statistic{
|
||||
Statistic: models.Statistic{
|
||||
Values: make(map[string]interface{}),
|
||||
},
|
||||
Statistic: models.NewStatistic(""),
|
||||
}
|
||||
|
||||
// Add any supplied tags.
|
||||
|
@ -277,10 +275,7 @@ func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error) {
|
|||
|
||||
// Add Go memstats.
|
||||
statistic := &Statistic{
|
||||
Statistic: models.Statistic{
|
||||
Name: "runtime",
|
||||
Values: make(map[string]interface{}),
|
||||
},
|
||||
Statistic: models.NewStatistic("runtime"),
|
||||
}
|
||||
|
||||
// Add any supplied tags to Go memstats
|
||||
|
|
Loading…
Reference in New Issue