@@ -202,7 +202,12 @@ func NewChannelsCollector(lnd lndclient.LightningClient, errChan chan<- error,
202202 for {
203203 err := collector .refreshClosedChannelsCache ()
204204 if err != nil {
205- errChan <- err
205+ Logger .Errorf ("ChannelsCollector refreshClosedChannelsCache " +
206+ "failed with: %v" , err )
207+
208+ if ! IsDeadlineExceeded (err ) {
209+ errChan <- err
210+ }
206211 }
207212
208213 select {
@@ -293,8 +298,14 @@ func (c *ChannelsCollector) Collect(ch chan<- prometheus.Metric) {
293298 // pending channel balances.
294299 chanBalResp , err := c .lnd .ChannelBalance (context .Background ())
295300 if err != nil {
296- c .errChan <- fmt .Errorf ("ChannelsCollector ChannelBalance " +
297- "failed with: %v" , err )
301+ errWithContext := fmt .Errorf ("ChannelsCollector ChannelBalance " +
302+ "failed with: %w" , err )
303+ Logger .Error (errWithContext )
304+
305+ if ! IsDeadlineExceeded (err ) {
306+ c .errChan <- errWithContext
307+ }
308+
298309 return
299310 }
300311
@@ -341,8 +352,14 @@ func (c *ChannelsCollector) Collect(ch chan<- prometheus.Metric) {
341352 // as well as the number of pending HTLCs.
342353 listChannelsResp , err := c .lnd .ListChannels (context .Background (), false , false )
343354 if err != nil {
344- c .errChan <- fmt .Errorf ("ChannelsCollector ListChannels " +
345- "failed with: %v" , err )
355+ errWithContext := fmt .Errorf ("ChannelsCollector ListChannels " +
356+ "failed with: %w" , err )
357+ Logger .Error (errWithContext )
358+
359+ if ! IsDeadlineExceeded (err ) {
360+ c .errChan <- errWithContext
361+ }
362+
346363 return
347364 }
348365
@@ -452,8 +469,14 @@ func (c *ChannelsCollector) Collect(ch chan<- prometheus.Metric) {
452469 // Get the list of pending channels
453470 pendingChannelsResp , err := c .lnd .PendingChannels (context .Background ())
454471 if err != nil {
455- c .errChan <- fmt .Errorf ("ChannelsCollector PendingChannels " +
456- "failed with: %v" , err )
472+ errWithContext := fmt .Errorf ("ChannelsCollector PendingChannels " +
473+ "failed with: %w" , err )
474+ Logger .Error (errWithContext )
475+
476+ if ! IsDeadlineExceeded (err ) {
477+ c .errChan <- errWithContext
478+ }
479+
457480 return
458481 }
459482 ch <- prometheus .MustNewConstMetric (
@@ -539,8 +562,14 @@ func (c *ChannelsCollector) Collect(ch chan<- prometheus.Metric) {
539562 // Get all remote policies
540563 remotePolicies , err := c .getRemotePolicies (getInfoResp .IdentityPubkey )
541564 if err != nil {
542- c .errChan <- fmt .Errorf ("ChannelsCollector getRemotePolicies " +
543- "failed with: %v" , err )
565+ errWithContext := fmt .Errorf ("ChannelsCollector getRemotePolicies " +
566+ "failed with: %w" , err )
567+ Logger .Error (errWithContext )
568+
569+ if ! IsDeadlineExceeded (err ) {
570+ c .errChan <- errWithContext
571+ }
572+
544573 return
545574 }
546575
0 commit comments