Documentation ¶
Overview ¶
Package common implements a bare-bones Integration that can be used by exporters that have no logic associated with them.
Index ¶
- type CollectorIntegration
- func (i *CollectorIntegration) CommonConfig() config.Common
- func (i *CollectorIntegration) Name() string
- func (i *CollectorIntegration) RegisterRoutes(r *mux.Router) error
- func (i *CollectorIntegration) Run(ctx context.Context) error
- func (i *CollectorIntegration) ScrapeConfigs() []config.ScrapeConfig
- type Integration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectorIntegration ¶
type CollectorIntegration struct {
// contains filtered or unexported fields
}
CollectorIntegration is an integration exposing metrics from a Prometheus collector.
func NewCollectorIntegration ¶
func NewCollectorIntegration(name string, cfg config.Common, c prometheus.Collector, includeExporterMetrics bool) *CollectorIntegration
NewCollectorIntegration creates a basic integration that exposes metrics from a prometheus.Collector.
func (*CollectorIntegration) CommonConfig ¶
func (i *CollectorIntegration) CommonConfig() config.Common
CommonConfig satisfies Integration.CommonConfig.
func (*CollectorIntegration) Name ¶
func (i *CollectorIntegration) Name() string
Name satisfies Integration.Name.
func (*CollectorIntegration) RegisterRoutes ¶
func (i *CollectorIntegration) RegisterRoutes(r *mux.Router) error
RegisterRoutes satisfies Integration.RegisterRoutes. The mux.Router provided here is expected to be a subrouter, where all registered paths will be registered within that subroute.
func (*CollectorIntegration) Run ¶
func (i *CollectorIntegration) Run(ctx context.Context) error
Run satisfies Integration.Run.
func (*CollectorIntegration) ScrapeConfigs ¶
func (i *CollectorIntegration) ScrapeConfigs() []config.ScrapeConfig
ScrapeConfigs satisfies Integration.ScrapeConfigs.
type Integration ¶
type Integration interface { // Name returns the name of the integration. Each registered integration must // have a unique name. Name() string // CommonConfig returns the set of common configuration values present across // all integrations. CommonConfig() config.Common // RegisterRoutes should register any HTTP handlers used for the integration. // // The router provided to RegisterRoutes is a subrouter for the path // /integrations/<integration name>. All routes should register to the // relative root path and will be automatically combined to the subroute. For // example, if a metric "database" registers a /metrics endpoint, it will // be exposed as /integrations/database/metrics. RegisterRoutes(r *mux.Router) error // ScrapeConfigs should return a set of integration scrape configs that inform // the integration how samples should be collected. ScrapeConfigs() []config.ScrapeConfig // Run should start the integration and do any required tasks. Run should *not* // exit until context is canceled. If an integration doesn't need to do anything, // it should simply wait for ctx to be canceled. Run(ctx context.Context) error }