Documentation ¶
Index ¶
- Constants
- Variables
- func Kind(kind string) schema.GroupKind
- func Resource(resource string) schema.GroupResource
- type Backend
- type Direction
- type Edge
- type Interval
- type Metric
- type Side
- 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 ( // To is used when an edge is sending traffic to a resource To Direction = "to" // From is used when an edge is receiving traffic from a resource From Direction = "from" // Server indicates that the metrics are measured on the server side Server Side = "server" // Client indicated that the metrics are measured on the client side Client Side = "client" )
const APIVersion = "metrics.smi-spec.io/v1alpha2"
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", }, }, "Trafficsplit": { Name: "trafficsplits", Namespaced: true, Kind: "TrafficMetrics", Verbs: []string{ "get", }, }, }
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: "v1alpha2", }
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 Backend ¶
type Backend struct { Apex string `json:"apex"` Name string `json:"name"` Weight int `json:"weight"` }
Backend describes which branch of a traffic split these metrics represent.
func (*Backend) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.
func (*Backend) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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"` Side Side `json:"side"` 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"` Backend *Backend `json:"backend"` 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