@@ -198,17 +198,21 @@ func (u *WalletCollector) Collect(ch chan<- prometheus.Metric) {
198198 path := account .GetDerivationPath ()
199199
200200 // internal key count.
201- ch <- prometheus .MustNewConstMetric (
202- u .keyCountDesc , prometheus .CounterValue ,
203- float64 (account .InternalKeyCount ),
204- name , addrType , path , "internal" ,
205- )
201+ if account .InternalKeyCount > 0 {
202+ ch <- prometheus .MustNewConstMetric (
203+ u .keyCountDesc , prometheus .CounterValue ,
204+ float64 (account .InternalKeyCount ),
205+ name , addrType , path , "internal" ,
206+ )
207+ }
206208
207209 // external key count.
208- ch <- prometheus .MustNewConstMetric (
209- u .keyCountDesc , prometheus .CounterValue ,
210- float64 (account .ExternalKeyCount ),
211- name , addrType , path , "external" ,
212- )
210+ if account .ExternalKeyCount > 0 {
211+ ch <- prometheus .MustNewConstMetric (
212+ u .keyCountDesc , prometheus .CounterValue ,
213+ float64 (account .ExternalKeyCount ),
214+ name , addrType , path , "external" ,
215+ )
216+ }
213217 }
214218}
0 commit comments