Documentation ¶
Index ¶
- Constants
- func GetContainerCpuUsageQueryExp(namespace string, workloadName string, kind string, containerName string, ...) string
- func GetContainerMemUsageQueryExp(namespace string, workloadName string, kind string, containerName string, ...) string
- func GetExtraFilters(extraFilters string, baseFilter string) string
- func NewPrometheusClient(config *PromConfig) (prometheusapi.Client, error)
- type PromConfig
- type PromDatasource
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 GetExtraFilters ¶
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.