api

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelPodId         = "pod_id"
	LabelPodName       = "pod_name"
	LabelPodNamespace  = "pod_namespace"
	LabelContainerName = "container_name"
	LabelLabels        = "labels"
	LabelHostname      = "hostname"
	LabelResourceID    = "resource_id"
)

Variables

This section is empty.

Functions

func LabelsToString

func LabelsToString(labels map[string]string, separator string) string

Concatenates a map of labels into a comma-separated key=value pairs.

Types

type Decoder

type Decoder interface {
	// Timeseries returns the metrics found in input as a timeseries slice.
	Timeseries(input source_api.AggregateData) ([]Timeseries, error)
}

Codec represents an engine that translated from sources.api to sink.api objects.

func NewDecoder

func NewDecoder() Decoder

type ExternalSink

type ExternalSink interface {
	// Registers a metric with the backend.
	Register([]MetricDescriptor) error
	// Stores input data into the backend.
	// Support input types are as follows:
	// 1. []Timeseries
	// TODO: Add map[string]string to support storing raw data like node or pod status, spec, etc.
	StoreTimeseries([]Timeseries) error
	// Stores events into the backend.
	StoreEvents([]kube_api.Event) error
	// Returns debug information specific to the sink.
	DebugInfo() string
	// Returns an user friendly string that describes the External Sink.
	Name() string
}

ExternalSink is the interface that needs to be implemented by all external storage backends.

type LabelDescriptor

type LabelDescriptor struct {
	// Key to use for the label.
	Key string `json:"key,omitempty"`

	// Description of the label.
	Description string `json:"description,omitempty"`
}

func SupportedLabels

func SupportedLabels() []LabelDescriptor

type MetricDescriptor

type MetricDescriptor struct {
	// The unique name of the metric.
	Name string

	// Description of the metric.
	Description string

	// Descriptor of the labels used by this metric.
	Labels []LabelDescriptor

	// Type and value of metric data.
	Type      MetricType
	ValueType MetricValueType
	Units     MetricUnitsType
}

TODO: Add cluster name.

type MetricType

type MetricType int
const (
	// A cumulative metric.
	MetricCumulative MetricType = iota

	// An instantaneous value metric.
	MetricGauge
)

func (MetricType) String

func (self MetricType) String() string

type MetricUnitsType

type MetricUnitsType int
const (
	// A counter metric.
	UnitsCount MetricUnitsType = iota
	// A metric in bytes.
	UnitsBytes
	// A metric in milliseconds.
	UnitsMilliseconds
	// A metric in nanoseconds.
	UnitsNanoseconds
)

func (*MetricUnitsType) String

func (self *MetricUnitsType) String() string

type MetricValueType

type MetricValueType int
const (
	// An int64 value.
	ValueInt64 MetricValueType = iota
	// A boolean value
	ValueBool
	// A double-precision floating point number.
	ValueDouble
)

func (MetricValueType) String

func (self MetricValueType) String() string

type Point

type Point struct {
	// The name of the metric. Must match an existing descriptor.
	Name string

	// The labels and values for the metric. The keys must match those in the descriptor.
	Labels map[string]string

	// The start and end time for which this data is representative.
	Start time.Time
	End   time.Time

	// The value of the metric. Must match the type in the descriptor.
	Value interface{}
}

type SupportedStatMetric

type SupportedStatMetric struct {
	MetricDescriptor

	// Returns whether this metric is present.
	HasValue func(*cadvisor.ContainerSpec) bool

	// Returns a slice of internal point objects that contain metric values and associated labels.
	GetValue func(*cadvisor.ContainerSpec, *cadvisor.ContainerStats) []internalPoint
}

SupportedStatMetric represents a resource usage stat metric.

func SupportedStatMetrics

func SupportedStatMetrics() []SupportedStatMetric

type Timeseries

type Timeseries struct {
	Point            *Point
	MetricDescriptor *MetricDescriptor
}

Timeseries represents a single metric.

Jump to

Keyboard shortcuts

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