Documentation ¶
Index ¶
- type Client
- func (in *Client) API() v1.API
- func (in *Client) Address() string
- func (in *Client) GetAllRequestRates(namespace string, ratesInterval string) (model.Vector, error)
- func (in *Client) GetAppRequestRates(namespace, app, ratesInterval string) (model.Vector, model.Vector, error)
- func (in *Client) GetMetrics(query *MetricsQuery) Metrics
- func (in *Client) GetServiceHealth(namespace, servicename string, ports []int32) (EnvoyServiceHealth, error)
- func (in *Client) GetServiceRequestRates(namespace, service, ratesInterval string) (model.Vector, error)
- func (in *Client) GetSourceWorkloads(namespace string, servicename string) (map[string][]Workload, error)
- func (in *Client) GetWorkloadRequestRates(namespace, workload, ratesInterval string) (model.Vector, model.Vector, error)
- func (in *Client) Inject(api v1.API)
- type ClientInterface
- type EnvoyRatio
- type EnvoyServiceHealth
- type Histogram
- type Metric
- type Metrics
- type MetricsQuery
- type Workload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ClientInterface // contains filtered or unexported fields }
Client for Prometheus API. It hides the way we query Prometheus offering a layer with a high level defined API.
func NewClient ¶
NewClient creates a new client to the Prometheus API. It returns an error on any problem.
func (*Client) API ¶
API returns the Prometheus V1 HTTP API for performing calls not supported natively by this client
func (*Client) GetAllRequestRates ¶ added in v0.6.0
GetAllRequestRates queries Prometheus to fetch request counters rates over a time interval within a namespace Returns (rates, error)
func (*Client) GetAppRequestRates ¶ added in v0.6.0
func (in *Client) GetAppRequestRates(namespace, app, ratesInterval string) (model.Vector, model.Vector, error)
GetAppRequestRates queries Prometheus to fetch request counters rates over a time interval for a given app, both in and out. Returns (in, out, error)
func (*Client) GetMetrics ¶ added in v0.6.0
func (in *Client) GetMetrics(query *MetricsQuery) Metrics
GetMetrics returns the Metrics related to the provided query options.
func (*Client) GetServiceHealth ¶
func (in *Client) GetServiceHealth(namespace, servicename string, ports []int32) (EnvoyServiceHealth, error)
GetServiceHealth returns the Health related to the provided service identified by its namespace and service name. It reads Envoy metrics, inbound and outbound When the health is unavailable, total number of members will be 0.
func (*Client) GetServiceRequestRates ¶
func (in *Client) GetServiceRequestRates(namespace, service, ratesInterval string) (model.Vector, error)
GetServiceRequestRates queries Prometheus to fetch request counters rates over a time interval for a given service (hence only inbound). Returns (in, error)
func (*Client) GetSourceWorkloads ¶ added in v0.6.0
func (in *Client) GetSourceWorkloads(namespace string, servicename string) (map[string][]Workload, error)
GetSourceWorkloads returns a map of list of source workloads for a given service identified by its namespace and service name. Returned map has a destination version as a key and a list of workloads as values. It returns an error on any problem.
func (*Client) GetWorkloadRequestRates ¶ added in v0.6.0
func (in *Client) GetWorkloadRequestRates(namespace, workload, ratesInterval string) (model.Vector, model.Vector, error)
GetWorkloadRequestRates queries Prometheus to fetch request counters rates over a time interval for a given workload, both in and out. Returns (in, out, error)
type ClientInterface ¶
type ClientInterface interface { GetServiceHealth(namespace, servicename string, ports []int32) (EnvoyServiceHealth, error) GetAllRequestRates(namespace, ratesInterval string) (model.Vector, error) GetServiceRequestRates(namespace, service, ratesInterval string) (model.Vector, error) GetAppRequestRates(namespace, app, ratesInterval string) (model.Vector, model.Vector, error) GetWorkloadRequestRates(namespace, workload, ratesInterval string) (model.Vector, model.Vector, error) GetSourceWorkloads(namespace, servicename string) (map[string][]Workload, error) }
ClientInterface for mocks (only mocked function are necessary here)
type EnvoyRatio ¶
EnvoyRatio is the number of healthy members versus total members
type EnvoyServiceHealth ¶ added in v0.6.0
type EnvoyServiceHealth struct { Inbound EnvoyRatio `json:"inbound"` Outbound EnvoyRatio `json:"outbound"` }
EnvoyServiceHealth is the number of healthy versus total membership (ie. replicas) inside envoy cluster for inbound and outbound traffic
type Histogram ¶
type Histogram struct { Average *Metric `json:"average"` Median *Metric `json:"median"` Percentile95 *Metric `json:"percentile95"` Percentile99 *Metric `json:"percentile99"` }
Histogram contains Metric objects for several histogram-kind statistics
type Metric ¶
type Metric struct { Matrix model.Matrix `json:"matrix"` // contains filtered or unexported fields }
Metric holds the Prometheus Matrix model, which contains one or more time series (depending on grouping)
type Metrics ¶
type Metrics struct { Metrics map[string]*Metric `json:"metrics"` Histograms map[string]Histogram `json:"histograms"` }
Metrics contains health, all simple metrics and histograms data
type MetricsQuery ¶
type MetricsQuery struct { v1.Range RateInterval string RateFunc string Filters []string ByLabelsIn []string ByLabelsOut []string Namespace string // TODO: replace with single string value when `business.GetApps` gets deleted Apps []string Workload string }
MetricsQuery holds query parameters for a typical metrics query
func (*MetricsQuery) FillDefaults ¶
func (q *MetricsQuery) FillDefaults()
FillDefaults fills the struct with default parameters