integrations

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		IntegrationRestartBackoff: 5 * time.Second,
		UseHostnameLabel:          true,
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// When true, adds an agent_hostname label to all samples from integrations.
	UseHostnameLabel bool `yaml:"use_hostname_label"`

	Agent        agent.Config         `yaml:"agent"`
	NodeExporter node_exporter.Config `yaml:"node_exporter"`

	// Extra labels to add for all integration samples
	Labels model.LabelSet `yaml:"labels"`

	// 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:"-"`
}

Config holds the configuration for all integrations.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler for Config.

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() integrationCfg.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() []integrationCfg.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
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages a set of integrations and runs them.

func NewManager

func NewManager(c Config, logger log.Logger, im ha.InstanceManager) (*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) Stop

func (m *Manager) Stop()

Stop stops the maanger and all of its integrations.

func (*Manager) WireAPI

func (m *Manager) WireAPI(r *mux.Router) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL