v1

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LabelPodId = LabelDescriptor{
		Key:         "pod_id",
		Description: "The unique ID of the pod",
	}
	LabelPodName = LabelDescriptor{
		Key:         "pod_name",
		Description: "The name of the pod",
	}
	LabelPodNamespace = LabelDescriptor{
		Key:         "pod_namespace",
		Description: "The namespace of the pod",
	}
	LabelPodNamespaceUID = LabelDescriptor{
		Key:         "namespace_id",
		Description: "The UID of namespace of the pod",
	}
	LabelContainerName = LabelDescriptor{
		Key:         "container_name",
		Description: "User-provided name of the container or full container name for system containers",
	}
	LabelLabels = LabelDescriptor{
		Key:         "labels",
		Description: "Comma-separated list of user-provided labels",
	}
	LabelHostname = LabelDescriptor{
		Key:         "hostname",
		Description: "Hostname where the container ran",
	}
	LabelResourceID = LabelDescriptor{
		Key:         "resource_id",
		Description: "Identifier(s) specific to a metric",
	}
	LabelHostID = LabelDescriptor{
		Key:         "host_id",
		Description: "Identifier specific to a host. Set by cloud provider or user",
	}
)

TODO(vmarmol): Things we should consider adding (note that we only get 10 labels): - POD name, container name, and host IP: Useful to users but maybe we should just mangle them with ID and IP - Namespace: Are IDs unique only per namespace? If so, mangle it into the ID.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	// Timeseries returns the metrics found in input as a timeseries slice.
	TimeseriesFromPods([]*cache.PodElement) ([]Timeseries, error)
	TimeseriesFromContainers([]*cache.ContainerElement) ([]Timeseries, error)
}

func NewDecoder

func NewDecoder() Decoder

type ExternalSink

type ExternalSink interface {
	// Registers a metric with the backend.
	Register([]MetricDescriptor) error
	// Unregisters a metric with the backend.
	Unregister([]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 InternalPoint

type InternalPoint struct {
	// Overrides any default labels generated for every Point.
	// This is typically used for metric specific labels like 'resource_id'.
	Labels map[string]string
	Value  interface{}
}

internalPoint is an internal object.

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 CommonLabels

func CommonLabels() []LabelDescriptor

func MetricLabels

func MetricLabels() []LabelDescriptor

func PodLabels

func PodLabels() []LabelDescriptor

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 specific to 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
	// A metric in millicores.
	UnitsMillicores
)

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

	// TODO(vmarmol): Make use of this.
	// Whether to only export if the metric's value has changed (Default: false).
	OnlyExportIfChanged bool
}

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