Skip to content

Commit

Permalink
chore(nodebuilder): bind OTLP error logging (celestiaorg#2861)
Browse files Browse the repository at this point in the history
A minor slight improvement. It was easy to miss errors in the log wall with the default logger. Here, I use our logging system. I tested it and it looks good
  • Loading branch information
Wondertan authored Oct 30, 2023
1 parent 1552e9e commit f6a649e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nodebuilder/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"time"

logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/pyroscope-io/client/pyroscope"
otelpyroscope "github.com/pyroscope-io/otel-profiling-go"
Expand Down Expand Up @@ -208,5 +209,14 @@ func initializeMetrics(
},
})
otel.SetMeterProvider(provider)
otel.SetErrorHandler(&loggingErrorHandler{})
return nil
}

var metricsLogger = logging.Logger("otlp")

type loggingErrorHandler struct{}

func (loggingErrorHandler) Handle(err error) {
metricsLogger.Error(err)
}

0 comments on commit f6a649e

Please sign in to comment.