chunk

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 98

Documentation

Index

Constants

View Source
const BatchSize = 12

BatchSize is samples per batch; this was choose by benchmarking all sizes from 1 to 128.

Variables

View Source
var BenchmarkLabels = labels.Labels{
	{Name: model.MetricNameLabel, Value: "container_cpu_usage_seconds_total"},
	{Name: "beta_kubernetes_io_arch", Value: "amd64"},
	{Name: "beta_kubernetes_io_instance_type", Value: "c3.somesize"},
	{Name: "beta_kubernetes_io_os", Value: "linux"},
	{Name: "container_name", Value: "some-name"},
	{Name: "cpu", Value: "cpu01"},
	{Name: "failure_domain_beta_kubernetes_io_region", Value: "somewhere-1"},
	{Name: "failure_domain_beta_kubernetes_io_zone", Value: "somewhere-1b"},
	{Name: "id", Value: "/kubepods/burstable/pod6e91c467-e4c5-11e7-ace3-0a97ed59c75e/a3c8498918bd6866349fed5a6f8c643b77c91836427fb6327913276ebc6bde28"},
	{Name: "image", Value: "registry/organisation/name@sha256:dca3d877a80008b45d71d7edc4fd2e44c0c8c8e7102ba5cbabec63a374d1d506"},
	{Name: "instance", Value: "ip-111-11-1-11.ec2.internal"},
	{Name: "job", Value: "kubernetes-cadvisor"},
	{Name: "kubernetes_io_hostname", Value: "ip-111-11-1-11"},
	{Name: "monitor", Value: "prod"},
	{Name: "name", Value: "k8s_some-name_some-other-name-5j8s8_kube-system_6e91c467-e4c5-11e7-ace3-0a97ed59c75e_0"},
	{Name: "namespace", Value: "kube-system"},
	{Name: "pod_name", Value: "some-other-name-5j8s8"},
}

BenchmarkLabels is a real example from Kubernetes' embedded cAdvisor metrics, lightly obfuscated

Functions

This section is empty.

Types

type Batch added in v1.18.0

type Batch struct {
	Timestamps      [BatchSize]int64
	Values          [BatchSize]float64
	Histograms      [BatchSize]*histogram.Histogram
	FloatHistograms [BatchSize]*histogram.FloatHistogram
	Index           int
	Length          int
	ValType         chunkenc.ValueType
}

Batch is a sorted set of (timestamp, value) pairs. They are intended to be small, and passed by value. Value can vary depending on the chunk value type.

type Chunk

type Chunk struct {
	// These fields will be in all chunks, including old ones.
	From    model.Time     `json:"from"`
	Through model.Time     `json:"through"`
	Metric  labels.Labels  `json:"metric"`
	Data    chunkenc.Chunk `json:"-"`
}

Chunk contains encoded timeseries data

func NewChunk

func NewChunk(metric labels.Labels, c chunkenc.Chunk, from, through model.Time) Chunk

NewChunk creates a new chunk

func (*Chunk) NewIterator added in v1.18.0

func (c *Chunk) NewIterator(iterator Iterator) Iterator

type Iterator added in v1.18.0

type Iterator interface {
	// Scans the next value in the chunk. Directly after the iterator has
	// been created, the next value is the first value in the
	// chunk. Otherwise, it is the value following the last value scanned or
	// found (by one of the Find... methods). Returns chunkenc.ValNoe if either
	// the end of the chunk is reached or an error has occurred.
	Scan() chunkenc.ValueType
	// Finds the oldest value at or after the provided time and returns the value type.
	// Returns chunkenc.ValNone if either the chunk contains no value at or after
	// the provided time, or an error has occurred.
	FindAtOrAfter(model.Time) chunkenc.ValueType
	// Returns a batch of the provisded size; NB not idempotent!  Should only be called
	// once per Scan.
	Batch(size int, valType chunkenc.ValueType) Batch
	// Returns the last error encountered. In general, an error signals data
	// corruption in the chunk and requires quarantining.
	Err() error
}

Iterator enables efficient access to the content of a chunk. It is generally not safe to use an Iterator concurrently with or after chunk mutation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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