Documentation
¶
Index ¶
- Variables
- func MarshalYAML(v interface{}) (interface{}, error)
- func RegisterIntegration(cfg Config)
- func UnmarshalYAML(out interface{}, unmarshal func(interface{}) error) error
- type CollectorIntegration
- type CollectorIntegrationConfig
- type Config
- type Configs
- type Integration
- type Manager
- type ManagerConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultManagerConfig = ManagerConfig{ ScrapeIntegrations: true, IntegrationRestartBackoff: 5 * time.Second, UseHostnameLabel: true, ReplaceInstanceLabel: true, }
DefaultManagerConfig holds the default settings for integrations.
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 one or more Prometheus collectors.
func NewCollectorIntegration ¶ added in v0.10.0
func NewCollectorIntegration(name string, configs ...CollectorIntegrationConfig) *CollectorIntegration
NewCollectorIntegration creates a basic integration that exposes metrics from multiple prometheus.Collector.
func (*CollectorIntegration) MetricsHandler ¶ added in v0.14.0
func (i *CollectorIntegration) MetricsHandler() (http.Handler, error)
MetricsHandler returns the HTTP handler for the integration.
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 CollectorIntegrationConfig ¶ added in v0.12.0
type CollectorIntegrationConfig func(integration *CollectorIntegration)
CollectorIntegrationConfig defines constructor configuration for NewCollectorIntegration
func WithCollectors ¶ added in v0.12.0
func WithCollectors(cs ...prometheus.Collector) CollectorIntegrationConfig
WithCollectors adds more collectors to the CollectorIntegration being created.
func WithExporterMetricsIncluded ¶ added in v0.12.0
func WithExporterMetricsIncluded(included bool) CollectorIntegrationConfig
WithExporterMetricsIncluded can enable the exporter metrics if the flag provided is enabled.
func WithRunner ¶ added in v0.12.0
func WithRunner(runner func(context.Context) error) CollectorIntegrationConfig
WithRunner replaces the runner of the CollectorIntegration. The runner function should run while the context provided is not done.
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
UnmarshalYAML implements yaml.Unmarshaler.
type Integration ¶
type Integration interface { // MetricsHandler returns an http.Handler that will return metrics. MetricsHandler() (http.Handler, 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 ¶
func NewManager(c ManagerConfig, logger log.Logger, im instance.Manager, validate configstore.Validator) (*Manager, error)
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.
func (*Manager) ApplyConfig ¶ added in v0.14.0
func (m *Manager) ApplyConfig(cfg ManagerConfig) error
ApplyConfig updates the configuration of the integrations subsystem.
type ManagerConfig ¶ added in v0.10.0
type ManagerConfig struct { // 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 []*config.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:"-"` TLSConfig config_util.TLSConfig `yaml:"http_tls_config,omitempty"` // This is set to true if the Server TLSConfig Cert and Key path are set ServerUsingTLS bool `yaml:"-"` }
ManagerConfig holds the configuration for all integrations.
func (*ManagerConfig) ApplyDefaults ¶ added in v0.14.0
func (c *ManagerConfig) ApplyDefaults(cfg *prom.Config) error
ApplyDefaults applies default settings to the ManagerConfig and validates that it can be used.
If any integrations are enabled and are configured to be scraped, the Prometheus configuration must have a WAL directory configured.
func (*ManagerConfig) DefaultRelabelConfigs ¶ added in v0.10.0
func (c *ManagerConfig) DefaultRelabelConfigs(hostname string) []*relabel.Config
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 elasticsearch_exporter instantiates the exporter from github.com/justwatchcom/elasticsearch_exporter Using the YAML config provided by the agent
|
Package elasticsearch_exporter instantiates the exporter from github.com/justwatchcom/elasticsearch_exporter Using the YAML config provided by the agent |
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 |