Documentation ¶
Index ¶
Constants ¶
const APIVersion = "metrics.smi-spec.io/v1alpha1"
Variables ¶
var AvailableKinds = map[string]*metav1.APIResource{ "Deployment": { Name: "deployments", Namespaced: true, Kind: "TrafficMetrics", Verbs: []string{ "get", "list", }, }, "Pod": { Name: "pods", Namespaced: true, Kind: "TrafficMetrics", Verbs: []string{ "get", "list", }, }, "Daemonset": { Name: "daemonsets", Namespaced: true, Kind: "TrafficMetrics", Verbs: []string{ "get", "list", }, }, "Statefulset": { Name: "statefulsets", Namespaced: true, Kind: "TrafficMetrics", Verbs: []string{ "get", "list", }, }, "Namespace": { Name: "namespaces", Namespaced: false, Kind: "TrafficMetrics", Verbs: []string{ "get", "list", }, }, }
var AvailableMetrics = []*Metric{ { Name: "p99_response_latency", Unit: MilliSeconds, Value: apiresource.NewQuantity(0, apiresource.DecimalSI), }, { Name: "p90_response_latency", Unit: MilliSeconds, Value: apiresource.NewQuantity(0, apiresource.DecimalSI), }, { Name: "p50_response_latency", Unit: MilliSeconds, Value: apiresource.NewQuantity(0, apiresource.DecimalSI), }, { Name: "success_count", Value: apiresource.NewQuantity(0, apiresource.DecimalSI), }, { Name: "failure_count", Value: apiresource.NewQuantity(0, apiresource.DecimalSI), }, }
AvailableMetrics are a list of the possible metrics that can be returned
Functions ¶
This section is empty.
Types ¶
type Direction ¶
type Direction string
Direction defines whether an edge is sending traffic to a resource or receiving traffic from a resource.
type Edge ¶
type Edge struct { Direction Direction `json:"direction"` Resource *v1.ObjectReference `json:"resource"` }
Edge describes the other resource that metrics are associated with
type Interval ¶
type Interval struct { Timestamp metav1.Time `json:"timestamp"` Window metav1.Duration `json:"window"` }
Interval defines the time interval from which metrics were collected
func NewInterval ¶
func NewInterval() *Interval
type Metric ¶
type Metric struct { Name string `json:"name"` Unit Unit `json:"unit,omitempty"` Value *apiresource.Quantity `json:"value"` }
Metric describes a name and value for specific metrics
type TrafficMetrics ¶
type TrafficMetrics struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` *Interval `json:",inline"` Resource *v1.ObjectReference `json:"resource"` Edge *Edge `json:"edge"` Metrics []*Metric `json:"metrics"` }
TrafficMetrics provide the metrics for a specific resource
func NewTrafficMetrics ¶
func NewTrafficMetrics(obj, edge *v1.ObjectReference) *TrafficMetrics
NewTrafficMetrics constructs a TrafficMetrics with all the defaults
func (*TrafficMetrics) Get ¶
func (t *TrafficMetrics) Get(name string) *Metric
Get returns a metric associated with a name
func (*TrafficMetrics) String ¶
func (t *TrafficMetrics) String() string
String returns a formatted string representation of this struct
type TrafficMetricsList ¶
type TrafficMetricsList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Resource *v1.ObjectReference `json:"resource"` Items []*TrafficMetrics `json:"items"` }
TrafficMetricsList provides a list of resources associated with a specific reference
func NewTrafficMetricsList ¶
func NewTrafficMetricsList( obj *v1.ObjectReference, edges bool) *TrafficMetricsList
NewTrafficMetricsList constructs a new object with defaults already configured
func (*TrafficMetricsList) Get ¶
func (lst *TrafficMetricsList) Get( obj, edge *v1.ObjectReference) *TrafficMetrics
Get will get the item that is associated with the object reference or create a default if it doesn't already exist.
func (*TrafficMetricsList) String ¶
func (lst *TrafficMetricsList) String() string
String returns a formatted string representation of this struct