Documentation ¶
Index ¶
- func GetLabelVal(str *string, label string) string
- func GetUnusedResources(promAddr string, maxSteps int, promQuery string) (map[Namespace]map[Element]string, int, error)
- func MapAdd(m map[Namespace]map[Element]string, ns Namespace, elem Element, ...)
- type Element
- type Host
- type IngNamespace
- type Ingress
- type IngressBackend
- type IngressMap
- type Namespace
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLabelVal ¶
GetLabelVal returns given label's value from Prometheus string. Exmaple of string: {exported_namespace="polo",host="polo-stage.test.com",ingress="polo-api-staging-p8080-1496620443",path="/"}
func GetUnusedResources ¶
func GetUnusedResources(promAddr string, maxSteps int, promQuery string) (map[Namespace]map[Element]string, int, error)
GetUnusedResources returns map of unused resources with real observed period in hours. This function works only for metrics with two elements. Example: `sum(rate(nginx_ingress_controller_requests[1h])) by (ingress, exported_namespace) == 0`
Types ¶
type IngNamespace ¶
type IngNamespace string
type IngressBackend ¶
type IngressBackend struct { // Specifies the name of the referenced service. ServiceName string `json:"serviceName" protobuf:"bytes,1,opt,name=serviceName"` // Specifies the port of the referenced service. ServicePort intstr.IntOrString `json:"servicePort" protobuf:"bytes,2,opt,name=servicePort"` }
IngressBackend
type IngressMap ¶
type IngressMap struct {
M map[IngNamespace]map[Ingress]map[Host]map[Path]IngressBackend
}
func (*IngressMap) AddIntoIngMap ¶
func (resultMap *IngressMap) AddIntoIngMap(ns IngNamespace, ing Ingress, host Host, path Path)
AddIntoIngMap is a method for IngMapInterface Fills maps from Prometheus. Example of metric: {exported_namespace="polo",host="polo-stage.test.com",ingress="polo-api-staging-p8080-1496620443",path="/"}
func (*IngressMap) GetUnusedIngresses ¶
func (resultMap *IngressMap) GetUnusedIngresses(promAddr string, maxSteps int, promQuery string) (observedPeriod int, err error)
GetUnusedIngresses `sum(rate(nginx_ingress_controller_request_size_count[1h])) by (exported_namespace, ingress, host, path) == 0`