config

package
v0.0.0-...-b984a18 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAltTokenSource

func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource

NewAltTokenSource constructs a new alternate token source for generating tokens.

Types

type AltTokenSource

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

AltTokenSource is the structure holding the data for the functionality needed to generates tokens

func (*AltTokenSource) Token

func (a *AltTokenSource) Token() (*oauth2.Token, error)

Token returns a token which may be used for authentication

type AuthConfig

type AuthConfig struct {
	Username string
	Password string
	Token    string
}

AuthConfig contains authentication data for making requests to components.

type CommonConfig

type CommonConfig struct {
	GceConfig                   *GceConfig
	SourceConfig                *SourceConfig
	OmitComponentName           bool
	DowncaseMetricNames         bool
	MonitoredResourceLabels     map[string]string
	MonitoredResourceTypePrefix string
}

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
	// This is actually instance name.
	Instance   string
	InstanceId string
}

GceConfig aggregates all GCE related configuration parameters.

func GetGceConfig

func GetGceConfig(project, cluster, clusterLocation, zone, node 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
	Protocol             string
	Host                 string
	Port                 uint
	Path                 string
	AuthConfig           AuthConfig
	Whitelisted          []string
	WhitelistedLabelsMap map[string]map[string]bool
	PodConfig            PodConfig
	MetricsPrefix        string
	CustomResourceType   string
	CustomLabels         map[string]string
}

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, defaultMetricsPrefix 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