Documentation ¶
Index ¶
- Constants
- Variables
- func Kind(kind string) schema.GroupKind
- func Resource(resource string) schema.GroupResource
- type Direction
- type Edge
- type Interval
- type Metric
- type TrafficMetrics
- type TrafficMetricsList
- func (in *TrafficMetricsList) DeepCopy() *TrafficMetricsList
- func (in *TrafficMetricsList) DeepCopyInto(out *TrafficMetricsList)
- func (in *TrafficMetricsList) DeepCopyObject() runtime.Object
- func (lst *TrafficMetricsList) Get(obj, edge *v1.ObjectReference) *TrafficMetrics
- func (lst *TrafficMetricsList) String() string
- type Unit
Constants ¶
const APIVersion = "metrics.smi-spec.io/v1alpha1"
Variables ¶
var ( // SchemeBuilder collects functions that add things to a scheme. It's to allow // code to compile without explicitly referencing generated types. You should // declare one in each package that will have generated deep copy or conversion // functions. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme applies all the stored functions to the scheme. A non-nil error // indicates that one function failed and the attempt was abandoned. AddToScheme = SchemeBuilder.AddToScheme )
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
var SchemeGroupVersion = schema.GroupVersion{ Group: metrics.GroupName, Version: "v1alpha1", }
SchemeGroupVersion is the identifier for the API which includes the name of the group and the version of the API
Functions ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource takes an unqualified resource and returns a Group qualified GroupResource
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
func (*Edge) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Edge.
func (*Edge) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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
func (*Interval) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Interval.
func (*Interval) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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
func (*Metric) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metric.
func (*Metric) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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) DeepCopy ¶
func (in *TrafficMetrics) DeepCopy() *TrafficMetrics
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficMetrics.
func (*TrafficMetrics) DeepCopyInto ¶
func (in *TrafficMetrics) DeepCopyInto(out *TrafficMetrics)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TrafficMetrics) DeepCopyObject ¶
func (in *TrafficMetrics) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
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) DeepCopy ¶
func (in *TrafficMetricsList) DeepCopy() *TrafficMetricsList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficMetricsList.
func (*TrafficMetricsList) DeepCopyInto ¶
func (in *TrafficMetricsList) DeepCopyInto(out *TrafficMetricsList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TrafficMetricsList) DeepCopyObject ¶
func (in *TrafficMetricsList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
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