config

package
v0.0.0-...-cd71283 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonConfig

type CommonConfig struct {
	GceConfig           *GceConfig
	PodConfig           PodConfig
	ComponentName       string
	OmitComponentName   bool
	DowncaseMetricNames bool
}

CommonConfig contains all required information about environment in which prometheus-to-sd running and which component is monitored.

type GceConfig

type GceConfig struct {
	Project                string
	Zone                   string
	Cluster                string
	ClusterLocation        string
	Instance               string
	MetricsPrefix          string
	MonitoredResourceTypes string
}

GceConfig aggregates all GCE related configuration parameters.

func GetGceConfig

func GetGceConfig(metricsPrefix, zone string, monitoredResourceTypes string) (*GceConfig, error)

GetGceConfig builds GceConfig based on the provided prefix and metadata server available on GCE.

type PodConfig

type PodConfig interface {
	// IsMetricLabel returns true if the label name should be added as a metric label
	IsMetricLabel(labelName string) bool

	// GetPodInfo returns the information required to identify the pod.
	GetPodInfo(labels []*dto.LabelPair) (containerName, podId, namespaceId string)
}

PodConfig can identify metric and resource information for pods.

func NewPodConfig

func NewPodConfig(podId, namespaceId, podIdLabel, namespaceIdLabel, containerNameLabel string) PodConfig

NewPodConfig returns a PodConfig which uses for the provided pod, namespace, and container label values, if found, and falls back to the podId and namespaceId.

type SourceConfig

type SourceConfig struct {
	Component   string
	Host        string
	Port        uint
	Path        string
	Whitelisted []string
	PodConfig   PodConfig
}

SourceConfig contains data specific for scraping one component.

func SourceConfigsFromDynamicSources

func SourceConfigsFromDynamicSources(gceConfig *GceConfig, sources []flags.Uri) ([]SourceConfig, error)

SourceConfigsFromDynamicSources takes pod specifications from the Kubernetes API and maps them to source configs.

func SourceConfigsFromFlags

func SourceConfigsFromFlags(source flags.Uris, podId *string, namespaceId *string) []SourceConfig

SourceConfigsFromFlags creates a slice of SourceConfig's base on the provided flags.

func (*SourceConfig) UpdateWhitelistedMetrics

func (config *SourceConfig) UpdateWhitelistedMetrics(list []string)

UpdateWhitelistedMetrics sets passed list as a list of whitelisted metrics.

Jump to

Keyboard shortcuts

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