Documentation
¶
Index ¶
Constants ¶
View Source
const ( LabelPodId = "pod_id" LabelPodName = "pod_name" LabelPodNamespace = "pod_namespace" LabelPodNamespaceUID = "namespace_id" LabelContainerName = "container_name" LabelLabels = "labels" LabelHostname = "hostname" LabelResourceID = "resource_id" LabelHostID = "host_id" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DecoderV1 ¶ added in v0.14.0
type DecoderV1 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 NewV1Decoder ¶ added in v0.14.0
func NewV1Decoder() DecoderV1
type DecoderV2 ¶ added in v0.14.0
type DecoderV2 interface {
// Timeseries returns the metrics found in input as a timeseries slice.
TimeseriesFromPods([]*cache.PodElement) ([]Timeseries, error)
TimeseriesFromContainers([]*cache.ContainerElement) ([]Timeseries, error)
}
func NewV2Decoder ¶ added in v0.14.0
func NewV2Decoder() DecoderV2
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 // 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.
Click to show internal directories.
Click to hide internal directories.