Permalink
Browse files
registry: track instance name lengths
- Loading branch information...
Showing
with
9 additions
and
1 deletion.
-
+9
−1
registry.go
|
|
@@ -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