Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultManagerConfig = ManagerConfig{ ScrapeIntegrations: true, IntegrationRestartBackoff: 5 * time.Second, UseHostnameLabel: true, ReplaceInstanceLabel: true, } )
Functions ¶
func MarshalYAML ¶ added in v0.10.0
func MarshalYAML(v interface{}) (interface{}, error)
MarshalYAML helps implement yaml.Marshaller for structs that have a Configs field that should be inlined in the YAML string.
func RegisterIntegration ¶ added in v0.10.0
func RegisterIntegration(cfg Config)
RegisterIntegration dynamically registers a new integration. The Config will represent the configuration that controls the specific integration. Registered Configs may be loaded using UnmarshalYAML or manually constructed.
RegisterIntegration panics if cfg is not a pointer.
func UnmarshalYAML ¶ added in v0.10.0
UnmarshalYAML helps implement yaml.Unmarshaller for structs that have a Configs field that should be inlined in the YAML string.
Types ¶
type CollectorIntegration ¶ added in v0.10.0
type CollectorIntegration struct {
// contains filtered or unexported fields
}
CollectorIntegration is an integration exposing metrics from a Prometheus collector.
func NewCollectorIntegration ¶ added in v0.10.0
func NewCollectorIntegration(name string, c prometheus.Collector, includeExporterMetrics bool) *CollectorIntegration
NewCollectorIntegration creates a basic integration that exposes metrics from a prometheus.Collector.
func (*CollectorIntegration) RegisterRoutes ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (i *CollectorIntegration) Run(ctx context.Context) error
Run satisfies Integration.Run.
func (*CollectorIntegration) ScrapeConfigs ¶ added in v0.10.0
func (i *CollectorIntegration) ScrapeConfigs() []config.ScrapeConfig
ScrapeConfigs satisfies Integration.ScrapeConfigs.
type Config ¶
type Config interface { // Name returns the name of the integration and the key that will be used to // pull the configuration from the Agent config YAML. Name() string // CommonConfig returns the set of common configuration values present across // all integrations. CommonConfig() config.Common // NewIntegration returns an integration for the given with the given logger. NewIntegration(l log.Logger) (Integration, error) }
Config provides the configuration and constructor for an integration.
type Configs ¶ added in v0.10.0
type Configs []Config
Configs is a list of integrations.
func (*Configs) UnmarshalYAML ¶ added in v0.10.0
type Integration ¶
type Integration interface { // RegisterRoutes should register any HTTP handlers needed for the // integrations. The mux router provided will be a subrouter for the path // /integrations/<integration name>, where the integration name is retrieved // by the config that created this integration. RegisterRoutes(r *mux.Router) error // ScrapeConfigs returns a set of scrape configs that determine where metrics // can be scraped. ScrapeConfigs() []config.ScrapeConfig // Run should start the integration and do any required tasks, if necessary. // For example, an Integration that requires a persistent connection to a // database would establish that connection here. If the integration doesn't // need to do anything, it should wait for the ctx to be canceled. Run(ctx context.Context) error }
An Integration is a process that integrates with some external system and pulls telemetry data.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages a set of integrations and runs them.
func NewManager ¶
NewManager creates a new integrations manager. NewManager must be given an InstanceManager which is responsible for accepting instance configs to scrape and send metrics from running integrations.
type ManagerConfig ¶ added in v0.10.0
type ManagerConfig struct { // Whether the Integration subsystem should be enabled. Enabled bool `yaml:"-"` // When true, scrapes metrics from integrations. ScrapeIntegrations bool `yaml:"scrape_integrations,omitempty"` // When true, replaces the instance label with the agent hostname. ReplaceInstanceLabel bool `yaml:"replace_instance_label,omitempty"` // DEPRECATED. When true, adds an agent_hostname label to all samples from integrations. // ReplaceInstanceLabel should be used instead. UseHostnameLabel bool `yaml:"use_hostname_label,omitempty"` // The integration configs is merged with the manager config struct so we // don't want to export it here; we'll manually unmarshal it in UnmarshalYAML. Integrations Configs `yaml:"-"` // Extra labels to add for all integration samples Labels model.LabelSet `yaml:"labels,omitempty"` // Prometheus RW configs to use for all integrations. PrometheusRemoteWrite []*instance.RemoteWriteConfig `yaml:"prometheus_remote_write,omitempty"` IntegrationRestartBackoff time.Duration `yaml:"integration_restart_backoff,omitempty"` // ListenPort tells the integration Manager which port the Agent is // listening on for generating Prometheus instance configs. ListenPort *int `yaml:"-"` // ListenHost tells the integration Manager which port the Agent is // listening on for generating Prometheus instance configs ListenHost *string `yaml:"-"` }
ManagerConfig holds the configuration for all integrations.
func (*ManagerConfig) DefaultRelabelConfigs ¶ added in v0.10.0
func (c *ManagerConfig) DefaultRelabelConfigs() ([]*relabel.Config, error)
DefaultRelabelConfigs returns the set of relabel configs that should be prepended to all RelabelConfigs for an integration.
func (ManagerConfig) MarshalYAML ¶ added in v0.10.0
func (c ManagerConfig) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler for ManagerConfig.
func (*ManagerConfig) UnmarshalYAML ¶ added in v0.10.0
func (c *ManagerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler for ManagerConfig.
Directories
¶
Path | Synopsis |
---|---|
Package agent is an "example" integration that has very little functionality, but is still useful in practice.
|
Package agent is an "example" integration that has very little functionality, but is still useful in practice. |
Package config provides common configuration structs shared among implementations of integrations.Integration.
|
Package config provides common configuration structs shared among implementations of integrations.Integration. |
Package consul_exporter embeds https://github.com/prometheus/consul_exporter
|
Package consul_exporter embeds https://github.com/prometheus/consul_exporter |
Package dnsmasq_exporter embeds https://github.com/google/dnsmasq_exporter
|
Package dnsmasq_exporter embeds https://github.com/google/dnsmasq_exporter |
Package install registers all in-source integrations for use.
|
Package install registers all in-source integrations for use. |
Package memcached_exporter embeds https://github.com/google/memcached_exporter
|
Package memcached_exporter embeds https://github.com/google/memcached_exporter |
Package mysqld_exporter embeds https://github.com/prometheus/mysqld_exporter
|
Package mysqld_exporter embeds https://github.com/prometheus/mysqld_exporter |
Package postgres_exporter embeds https://github.com/prometheus/postgres_exporter
|
Package postgres_exporter embeds https://github.com/prometheus/postgres_exporter |
Package process_exporter embeds https://github.com/ncabatoff/process-exporter Package process_exporter embeds https://github.com/ncabatoff/process-exporter
|
Package process_exporter embeds https://github.com/ncabatoff/process-exporter Package process_exporter embeds https://github.com/ncabatoff/process-exporter |
package redis_exporter embeds https://github.com/oliver006/redis_exporter
|
package redis_exporter embeds https://github.com/oliver006/redis_exporter |
Package statsd_exporter embeds https://github.com/prometheus/statsd_exporter
|
Package statsd_exporter embeds https://github.com/prometheus/statsd_exporter |