Documentation
¶
Index ¶
- Constants
- Variables
- func AsMetricsCollector(collector prometheus.Collector) fx.Option
- func AsMetricsCollectors(collectors ...prometheus.Collector) fx.Option
- func NewFxMetricsRegistry(p FxMetricsRegistryParam) (*prometheus.Registry, error)
- type DefaultMetricsRegistryFactory
- type FxMetricsRegistryParam
- type MetricsRegistryFactory
Constants ¶
View Source
const ModuleName = "metrics"
ModuleName is the module name.
Variables ¶
View Source
var FxMetricsModule = fx.Module( ModuleName, fx.Provide( NewDefaultMetricsRegistryFactory, NewFxMetricsRegistry, ), )
FxMetricsModule is the Fx metrics module.
Functions ¶
func AsMetricsCollector ¶
func AsMetricsCollector(collector prometheus.Collector) fx.Option
AsMetricsCollector registers a prometheus.Collector into Fx.
func AsMetricsCollectors ¶
func AsMetricsCollectors(collectors ...prometheus.Collector) fx.Option
AsMetricsCollectors registers a list of prometheus.Collector into Fx.
func NewFxMetricsRegistry ¶
func NewFxMetricsRegistry(p FxMetricsRegistryParam) (*prometheus.Registry, error)
NewFxMetricsRegistry returns a prometheus.Registry.
Types ¶
type DefaultMetricsRegistryFactory ¶
type DefaultMetricsRegistryFactory struct{}
DefaultMetricsRegistryFactory is the default MetricsRegistryFactory implementation.
func (*DefaultMetricsRegistryFactory) Create ¶
func (f *DefaultMetricsRegistryFactory) Create() (*prometheus.Registry, error)
Create returns a new prometheus.Registry.
type FxMetricsRegistryParam ¶
type FxMetricsRegistryParam struct { fx.In Factory MetricsRegistryFactory Config *config.Config Logger *log.Logger Collectors []prometheus.Collector `group:"metrics-collectors"` }
FxMetricsRegistryParam allows injection of the required dependencies in NewFxMetricsRegistry.
type MetricsRegistryFactory ¶
type MetricsRegistryFactory interface {
Create() (*prometheus.Registry, error)
}
MetricsRegistryFactory is the interface for prometheus.Registry factories.
func NewDefaultMetricsRegistryFactory ¶
func NewDefaultMetricsRegistryFactory() MetricsRegistryFactory
NewDefaultMetricsRegistryFactory returns a DefaultMetricsRegistryFactory, implementing MetricsRegistryFactory.
Click to show internal directories.
Click to hide internal directories.