docker

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package docker is an observer that watches a docker daemon and reports container ports as service endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigLabels

func GetConfigLabels(labels map[string]string) map[ContPort]*LabelConfig

GetConfigLabels converts a set of docker labels into configs organized based on the port

Types

type Config

type Config struct {
	config.ObserverConfig
	DockerURL string `yaml:"dockerURL" default:"unix:///var/run/docker.sock"`
	// A mapping of container label names to dimension names that will get
	// applied to the metrics of all discovered services. The corresponding
	// label values will become the dimension values for the mapped name.  E.g.
	// `io.kubernetes.container.name: container_spec_name` would result in a
	// dimension called `container_spec_name` that has the value of the
	// `io.kubernetes.container.name` container label.
	LabelsToDimensions map[string]string `yaml:"labelsToDimensions"`
	// If true, the "Config.Hostname" field (if present) of the docker
	// container will be used as the discovered host that is used to configure
	// monitors.  If false or if no hostname is configured, the field
	// `NetworkSettings.IPAddress` is used instead.
	UseHostnameIfPresent bool `yaml:"useHostnameIfPresent"`
	// If true, the observer will configure monitors for matching container endpoints
	// using the host bound ip and port.  This is useful if containers exist that are not
	// accessible to an instance of the agent running outside of the docker network stack.
	UseHostBindings bool `yaml:"useHostBindings" default:"false"`
	// If true, the observer will ignore discovered container endpoints that are not bound
	// to host ports.  This is useful if containers exist that are not accessible
	// to an instance of the agent running outside of the docker network stack.
	IgnoreNonHostBindings bool `yaml:"ignoreNonHostBindings" default:"false"`
}

Config specific to the Docker observer

type ContPort

type ContPort struct {
	nat.Port
	Name string
}

ContPort is a struct that contains Port data and a given name

type Docker

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

Docker observer plugin

func (*Docker) Configure

func (docker *Docker) Configure(config *Config) error

Configure the docker client

func (*Docker) Shutdown

func (docker *Docker) Shutdown()

Shutdown the service differ routine

type LabelConfig

type LabelConfig struct {
	MonitorType   string
	Configuration map[string]interface{}
}

LabelConfig contains type and other configurations of a monitor

Jump to

Keyboard shortcuts

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