v1alpha1

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

View Source
const APIVersion = "metrics.smi-spec.io/v1alpha1"

Variables

View Source
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
)
View Source
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",
		},
	},
}
View Source
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

View Source
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 Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

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.

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"
)

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

func (in *Edge) DeepCopy() *Edge

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Edge.

func (*Edge) DeepCopyInto

func (in *Edge) DeepCopyInto(out *Edge)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Edge) String

func (e *Edge) String() string

String returns a formatted string representation of this struct

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

func (in *Interval) DeepCopy() *Interval

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Interval.

func (*Interval) DeepCopyInto

func (in *Interval) DeepCopyInto(out *Interval)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Interval) String

func (i *Interval) String() string

String returns a formatted string representation of this struct

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

func (in *Metric) DeepCopy() *Metric

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metric.

func (*Metric) DeepCopyInto

func (in *Metric) DeepCopyInto(out *Metric)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Metric) Set

func (m *Metric) Set(val float64)

Set will set the value correctly

func (*Metric) String

func (m *Metric) String() string

String returns a formatted string representation of this struct

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

type Unit

type Unit string

Unit is associated with metrics and defines what unit the metric is using

const MilliSeconds Unit = "ms"

MilliSeconds is a time unit

Jump to

Keyboard shortcuts

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