prometheus

package
v0.0.0-...-881d3a2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLabelVal

func GetLabelVal(str *string, label string) string

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`

func MapAdd

func MapAdd(m map[Namespace]map[Element]string, ns Namespace, elem Element, deployment string)

MapAdd adds element into map of map

Types

type Element

type Element string // Pod/Ingress/etc.

type Host

type Host string

type IngNamespace

type IngNamespace string

type Ingress

type Ingress string

GetUnusedIngresses structures and types

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`

type Namespace

type Namespace string

type Path

type Path string

Jump to

Keyboard shortcuts

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