forked from mirrors/statsd_exporter
Merge pull request #335 from shmsr/dup-init-vars
Avoid double initialization of variables
This commit is contained in:
commit
da85f9d207
1 changed files with 7 additions and 5 deletions
|
@ -107,18 +107,20 @@ func (r *Registry) Store(metricName string, hash metrics.LabelHash, labels prome
|
|||
metric.Vectors[hash.Names] = v
|
||||
}
|
||||
|
||||
now := clock.Now()
|
||||
rm, ok := metric.Metrics[hash.Values]
|
||||
if !ok {
|
||||
rm = &metrics.RegisteredMetric{
|
||||
Labels: labels,
|
||||
TTL: ttl,
|
||||
Metric: mh,
|
||||
VecKey: hash.Names,
|
||||
LastRegisteredAt: now,
|
||||
Labels: labels,
|
||||
TTL: ttl,
|
||||
Metric: mh,
|
||||
VecKey: hash.Names,
|
||||
}
|
||||
metric.Metrics[hash.Values] = rm
|
||||
v.RefCount++
|
||||
return
|
||||
}
|
||||
now := clock.Now()
|
||||
rm.LastRegisteredAt = now
|
||||
// Update ttl from mapping
|
||||
rm.TTL = ttl
|
||||
|
|
Loading…
Reference in a new issue