#204 fix error handling for prometheus in client instantiation

This commit is contained in:
Alex Senger 2024-09-19 12:15:07 +02:00
parent 5ea50e2847
commit cd78cde0be
No known key found for this signature in database
GPG key ID: 0B4A96F8AF6934CF

View file

@ -66,12 +66,12 @@ func New(streamName string, opts ...Option) (*Consumer, error) {
}
if c.metricRegistry != nil {
var err error
errors.Join(err, c.metricRegistry.Register(collectorMillisBehindLatest))
errors.Join(err, c.metricRegistry.Register(counterEventsConsumed))
errors.Join(err, c.metricRegistry.Register(counterCheckpointsWritten))
if err != nil {
return nil, err
var errs error
errs = errors.Join(errs, c.metricRegistry.Register(collectorMillisBehindLatest))
errs = errors.Join(errs, c.metricRegistry.Register(counterEventsConsumed))
errs = errors.Join(errs, c.metricRegistry.Register(counterCheckpointsWritten))
if errs != nil {
return nil, errs
}
}