Permalink
Browse files

registry: try adding Indom instead of panicing when it is absent

  • Loading branch information...
1 parent 07df091 commit 7b8524cbf3d6a0b7e818f7ca1added5ce209afd3 @suyash suyash committed Aug 10, 2016
Showing with 4 additions and 1 deletion.
  1. +4 −1 registry.go
View
@@ -213,7 +213,10 @@ func (r *PCPRegistry) AddMetric(m Metric) error {
// if it is an indom metric
if pcpm.Indom() != nil && !r.HasInstanceDomain(pcpm.Indom().Name()) {
- return errors.New("the metric's instance domain is not defined for current registry")
+ err := r.AddInstanceDomain(pcpm.Indom())
+ if err != nil {
+ return err
+ }
}
r.metricslock.Lock()

0 comments on commit 7b8524c

Please sign in to comment.