Permalink
Browse files

registry: track instance name lengths

  • Loading branch information...
1 parent 67414d9 commit 2bdf2152dd5ddba5248dfe54431c8fd3fa4b81da @suyash suyash committed Aug 6, 2016
Showing with 9 additions and 1 deletion.
  1. +9 −1 registry.go
View
@@ -108,7 +108,7 @@ func (r *PCPRegistry) ValuesCount() int { return r.valueCount }
// StringCount returns the number of strings in the registry
func (r *PCPRegistry) StringCount() int {
if r.version2 {
- return r.stringcount + r.MetricCount()
+ return r.stringcount + r.MetricCount() + r.InstanceCount()
}
return r.stringcount
@@ -148,6 +148,14 @@ func (r *PCPRegistry) AddInstanceDomain(indom InstanceDomain) error {
r.instanceDomains[indom.Name()] = indom.(*PCPInstanceDomain)
r.instanceCount += indom.InstanceCount()
+ if !r.version2 {
+ for _, v := range indom.Instances() {
+ if len(v) > MaxV1MetricNameLength {
+ r.version2 = true
+ }
+ }
+ }
+
log.WithFields(logrus.Fields{
"prefix": "registry",
"name": indom.Name(),

0 comments on commit 2bdf215

Please sign in to comment.