You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your hard work in implementing such an awesome library.
Upon exploring kprom, I noticed that this module implements the Prometheus collector differently.
Instead of implementing a Prometheus collector like below:
// NewCustomCollector creates a new CustomCollectorfuncNewCustomCollector() *CustomCollector {
counter:=prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "my_custom_counter",
Help: "A custom counter for demonstration purposes",
},
[]string{"label"},
)
prometheus.MustRegister(counter)
return&CustomCollector{
counter: counter,
}
}
// Collect implements the Collector interfacefunc (c*CustomCollector) Collect(chchan<- prometheus.Metric) {
// Simulate some metricsc.counter.WithLabelValues("example").Inc()
c.counter.WithLabelValues("example2").Inc()
// Collect the metricsc.counter.Collect(ch)
}
// Describe implements the Collector interfacefunc (c*CustomCollector) Describe(chchan<-*prometheus.Desc) {
c.counter.Describe(ch)
}
Is there any specific reason behind this implementation style, or would you be open to approving a pull request for this modification?
The text was updated successfully, but these errors were encountered:
This will allow applications that use kprom to register multiple collectors to the same registry by inversing the dependency.
We will then be following the recommended approach of collector implementation
Hello there,
Thank you for your hard work in implementing such an awesome library.
Upon exploring kprom, I noticed that this module implements the Prometheus collector differently.
Instead of implementing a Prometheus collector like below:
Is there any specific reason behind this implementation style, or would you be open to approving a pull request for this modification?
The text was updated successfully, but these errors were encountered: