ernado opened a new issue #352:
URL: https://github.com/apache/pulsar-client-go/issues/352
**Is your feature request related to a problem? Please describe.**
Currently `promauto.NewCounter`, `promauto.NewGauge`, etc are used in such
way:
```go
var (
consumersOpened = promauto.NewCounter(prometheus.CounterOpts{
Name: "pulsar_client_consumers_opened",
Help: "Counter of consumers created by the client",
})
consumersClosed = promauto.NewCounter(prometheus.CounterOpts{
Name: "pulsar_client_consumers_closed",
Help: "Counter of consumers closed by the client",
})
consumersPartitions = promauto.NewGauge(prometheus.GaugeOpts{
Name: "pulsar_client_consumers_partitions_active",
Help: "Counter of individual partitions the consumers are
currently active",
})
)
```
There are several problems with such approach:
1. Using `prometheus.DefaultRegisterer`
2. Using global variables
**Describe the solution you'd like**
1. Add an ability to provide custom prometheus registry instance
2. Remove global variable usage in favor of dependency injection (e.g. via
struct fields like logger)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]