metricsprovider

package
v1.15.12 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sClientName      = "KubernetesMetricsServer"
	PromClientName     = "Prometheus"
	SignalFxClientName = "SignalFx"

	MetricsProviderNameKey    = "METRICS_PROVIDER_NAME"
	MetricsProviderAddressKey = "METRICS_PROVIDER_ADDRESS"
	MetricsProviderTokenKey   = "METRICS_PROVIDER_TOKEN"
	InsecureSkipVerify        = "INSECURE_SKIP_VERIFY"
)
View Source
const (
	EnableOpenShiftAuth = "ENABLE_OPENSHIFT_AUTH"
	KubeConfig          = "KUBE_CONFIG"
)
View Source
const (
	// SignalFX Request Params
	DefaultSignalFxAddress = "https://api.signalfx.com"

	AND = "AND"
)

Variables

This section is empty.

Functions

func Ping

func Ping(client http.Client, url string) (int, error)

Simple ping utility to a given URL Returns -1 if unhealthy, 0 if healthy along with error if any

Types

type MetricsProviderClient

type MetricsProviderClient interface {
	// Return the client name
	Name() string
	// Fetch metrics for given host
	FetchHostMetrics(host string, window *metricstype.Window) ([]metricstype.Metric, error)
	// Fetch metrics for all hosts
	FetchAllHostsMetrics(window *metricstype.Window) (map[string][]metricstype.Metric, error)
	// Get metric provider server health status
	// Returns 0 if healthy, -1 if unhealthy along with error if any
	Healthy() (int, error)
}

Interface to be implemented by any metrics provider client to interact with Watcher

func NewMetricsProvider

func NewMetricsProvider() (MetricsProviderClient, error)

func NewMetricsServerClient

func NewMetricsServerClient() (MetricsProviderClient, error)

func NewSignalFxClient

func NewSignalFxClient(opts MetricsProviderOpts) (MetricsProviderClient, error)

type MetricsProviderOpts

type MetricsProviderOpts struct {
	Name               string
	Address            string
	AuthToken          string
	InsecureSkipVerify bool
}

Generic metrics provider options

var (
	EnvMetricProviderOpts MetricsProviderOpts
)

type PromMethod

type PromMethod = string
const (
	Std    PromMethod = "stddev_over_time"
	Avg    PromMethod = "avg_over_time"
	Latest PromMethod = "Latest"
)

type PromResource

type PromResource = string
const (
	KubeNodeStatusCapacity PromResource = "kube_node_status_capacity"
	NodeCpuRatio           PromResource = "instance:node_cpu:ratio"
	NodeMemoryUtilRatio    PromResource = "instance:node_memory_utilisation:ratio"
	NodeRunningPodCount    PromResource = "kubelet_running_pods"

	NodeCpuRateSum           PromResource = "instance:node_cpu:rate:sum"
	NodeCpuNum               PromResource = "instance:node_num_cpu:sum"
	NodeNetworkReceiveBytes  PromResource = "instance:node_network_receive_bytes:rate:sum"
	NodeNetworkTransmitBytes PromResource = "instance:node_network_transmit_bytes:rate:sum"

	NodeCpuUtilRate5m                         PromResource = "instance:node_cpu_utilisation:rate5m"
	NodeNetworkReceiveBytesExcludinglo5m      PromResource = "instance:node_network_receive_bytes_excluding_lo:rate5m"
	NodeNetworkReceiveDropBytesExcludinglo5m  PromResource = "instance:node_network_receive_drop_excluding_lo:rate5m"
	NodeNetworkTransmitBytesExcludinglo5m     PromResource = "instance:node_network_transmit_bytes_excluding_lo:rate5m"
	NodeNetworkTransmitDropBytesExcludinglo5m PromResource = "instance:node_network_transmit_drop_excluding_lo:rate5m"
	NodeNetworkTotalBytesExcludinglo5m        PromResource = `` /* 129-byte string literal not displayed */

	NodeDiskIOTimeSecondsRate5m         PromResource = "instance_device:node_disk_io_time_seconds:rate5m"
	NodeDiskIOTimeWeightedSecondsRate5m PromResource = "instance_device:node_disk_io_time_weighted_seconds:rate5m"
)

type PromSQL

type PromSQL = string
const (
	PromSQLNodeDiskTotalUtilRate PromSQL = "sum by (instance) (rate(node_disk_reads_completed_total[%s]) + rate(node_disk_writes_completed_total[%s]))"
	PromSQLNodeDiskReadUtilRate  PromSQL = "sum by (instance) (rate(node_disk_reads_completed_total[%s]))"
	PromSQLNodeDiskWriteUtilRate PromSQL = "sum by (instance) (rate(node_disk_writes_completed_total[%s]))"

	PromSQLNodeDiskUtilRate5m PromSQL = `sum by (instance) (
		instance_device:node_disk_io_time_seconds:rate5m
	)`

	PromSQLNodeDiskSaturation5m PromSQL = `` /* 165-byte string literal not displayed */

	PodClassOfNodeName = "pod_class_of_node_count"
)

Jump to

Keyboard shortcuts

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