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
|
metric.Vectors[hash.Names] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
now := clock.Now()
|
||||||
rm, ok := metric.Metrics[hash.Values]
|
rm, ok := metric.Metrics[hash.Values]
|
||||||
if !ok {
|
if !ok {
|
||||||
rm = &metrics.RegisteredMetric{
|
rm = &metrics.RegisteredMetric{
|
||||||
Labels: labels,
|
LastRegisteredAt: now,
|
||||||
TTL: ttl,
|
Labels: labels,
|
||||||
Metric: mh,
|
TTL: ttl,
|
||||||
VecKey: hash.Names,
|
Metric: mh,
|
||||||
|
VecKey: hash.Names,
|
||||||
}
|
}
|
||||||
metric.Metrics[hash.Values] = rm
|
metric.Metrics[hash.Values] = rm
|
||||||
v.RefCount++
|
v.RefCount++
|
||||||
|
return
|
||||||
}
|
}
|
||||||
now := clock.Now()
|
|
||||||
rm.LastRegisteredAt = now
|
rm.LastRegisteredAt = now
|
||||||
// Update ttl from mapping
|
// Update ttl from mapping
|
||||||
rm.TTL = ttl
|
rm.TTL = ttl
|
||||||
|
|
Loading…
Reference in a new issue