prometheus

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GroupAPI is the group API scope use in this package
	GroupAPI = "sxlibs.k8s.startx.fr"
	// GroupName is the group name use in this package
	GroupName = "prometheus"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Prometheus

type Prometheus struct {
	URL   string
	Token string
	// contains filtered or unexported fields
}

Prometheus structure

func NewPrometheus

func NewPrometheus(kclient *sxKCli.K8sClient) *Prometheus

Initialize a kubeconfig object ex:

kubeconfig := kc.NewPrometheus()

func (*Prometheus) ExecPrometheusMultipleQuery

func (prom *Prometheus) ExecPrometheusMultipleQuery(queries map[string]string, promApi promv1.API, startDate time.Time, stopDate time.Time, stepTime time.Duration, metricKey string, deep bool) (map[string]map[string]map[string]float64, error)

func (*Prometheus) ExecPrometheusQuery

func (prom *Prometheus) ExecPrometheusQuery(promQuery string) ([][]string, error)

Find informations about OpenShift Prometheus

func (*Prometheus) FindPrometheusOCPRoute

func (prom *Prometheus) FindPrometheusOCPRoute(namespaceIn string, routeIn string) (string, error)

Get the prometheus route URL

func (*Prometheus) FindPrometheusOCPSAToken

func (prom *Prometheus) FindPrometheusOCPSAToken(namespaceIn string, saIn string) (string, error)

Get the prometheus SA token located into the given namespace and according to the given ServiceAccount name

func (*Prometheus) GetPrometheusConnection

func (prom *Prometheus) GetPrometheusConnection(insecure bool) (promv1.API, error)

Prepare the connection to Prometheus

func (*Prometheus) QueryParseModelMetric

func (prom *Prometheus) QueryParseModelMetric(queryName string, sample *model.SampleStream, metricKey string) (string, float64, float64, float64, float64, float64, float64, int, error)

func (*Prometheus) SetPrometheusOCP

func (prom *Prometheus) SetPrometheusOCP() error

Find connection details about OpenShift Prometheus

type PrometheusResponse

type PrometheusResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string `json:"resultType"`
		Result     []struct {
			Metric struct {
				Instance string `json:"instance"`
				Node     string `json:"node"`
			} `json:"metric"`
			Value []interface{} `json:"value"`
		} `json:"result"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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