prometheus

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContainerCpuUsageQueryExpr is used to query container cpu usage by promql
	ContainerCpuUsageQueryExpr = `rate(container_cpu_usage_seconds_total{container!="POD",namespace="%s",pod=~"%s",container="%s"%s}[30s])`
	// ContainerMemUsageQueryExpr is used to query container cpu usage by promql
	ContainerMemUsageQueryExpr = `container_memory_working_set_bytes{container!="POD",namespace="%s",pod=~"%s",container="%s"%s}`
)
View Source
const (
	WorkloadSuffixRuleForDeployment = `[a-z0-9]+-[a-z0-9]{5}$`
)

Variables

This section is empty.

Functions

func GetContainerCpuUsageQueryExp

func GetContainerCpuUsageQueryExp(namespace string, workloadName string, kind string, containerName string, extraFilters string) string

func GetContainerMemUsageQueryExp

func GetContainerMemUsageQueryExp(namespace string, workloadName string, kind string, containerName string, extraFilters string) string

func GetExtraFilters

func GetExtraFilters(extraFilters string, baseFilter string) string

func NewPrometheusClient

func NewPrometheusClient(config *PromConfig) (prometheusapi.Client, error)

NewPrometheusClient returns a prometheus.Client

Types

type PromConfig

type PromConfig struct {
	Address            string
	Timeout            time.Duration
	KeepAlive          time.Duration
	InsecureSkipVerify bool
	Auth               auth.ClientAuth

	QueryConcurrency            int
	BRateLimit                  bool
	MaxPointsLimitPerTimeSeries int
	TLSHandshakeTimeoutInSecond time.Duration

	BaseFilter string
}

PromConfig represents the config of prometheus

type PromDatasource

type PromDatasource interface {
	datasource.Datasource
	GetPromClient() promapiv1.API
}

func NewPrometheus

func NewPrometheus(config *PromConfig) (PromDatasource, error)

NewPrometheus return a prometheus data source

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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