models

package
v1.0.2-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatusQuery

func GetStatusQuery(name string) string

GetStatusQuery returns a query

func GetStatusQueryByDestination

func GetStatusQueryByDestination(name string) string

GetStatusQueryByDestination returns a query

func GetStatusQueryBySource

func GetStatusQueryBySource(name string) string

GetStatusQueryBySource returns a query

func GetWorkloadQuery

func GetWorkloadQuery() string

GetWorkloadQuery returns a workload query

func GetWorkloads

func GetWorkloads(addr string) (map[string]Workload, error)

GetWorkloads returns workload with it's destination workloads

Types

type AggregatedStatus

type AggregatedStatus struct {
	Step   time.Duration
	Status map[int64]AggregatedStatusItem
}

AggregatedStatus calculates status.

func (*AggregatedStatus) AddStatus

func (as *AggregatedStatus) AddStatus(
	t time.Time,
	v float64,
) map[int64]AggregatedStatusItem

AddStatus adds a new workload status.

func (*AggregatedStatus) Aggregate

func (as *AggregatedStatus) Aggregate(
	hsv utils.SliceFloat64,
) []AggregatedStatusItem

Aggregate turns the map to an aggregated array.

type AggregatedStatusItem

type AggregatedStatusItem struct {
	Time   time.Time `json:"date"`
	Status string    `json:"status"`
	Values []float64 `json:"-"`
	// pointer as they can be JSON null
	ApproximateMedian *float64 `json:"approximateMedian"`
	Avg               *float64 `json:"avg"`
	Median            *float64 `json:"median"`
}

AggregatedStatusItem holds the status.

type Workload

type Workload struct {
	Name         string                 `json:"name"`          // name of the workload
	App          string                 `json:"app,omitempty"` // istio app
	Sources      []Workload             `json:"sources"`
	Destinations []Workload             `json:"destinations"`
	Statuses     []AggregatedStatusItem `json:"statuses"`
}

Workload struct.

func GetWorkloadStatusByName

func GetWorkloadStatusByName(
	addr string,
	name string,
	start time.Time,
	end time.Time,
	historical time.Duration,
	statusStep time.Duration,
) (*Workload, error)

GetWorkloadStatusByName returns a single workload with it's status.

func (*Workload) AddDestination

func (w *Workload) AddDestination(wi Workload) []Workload

AddDestination adds a destination workload

func (*Workload) AddSource

func (w *Workload) AddSource(wi Workload) []Workload

AddSource adds a source workload

type WorkloadStatus

type WorkloadStatus struct {
	Time   time.Time `json:"date"`
	Status string    `json:"status"`
}

WorkloadStatus struct.

Jump to

Keyboard shortcuts

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