metrics

package
v0.0.0-...-b4871a6 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricBuilder

type MetricBuilder struct {
	// contains filtered or unexported fields
}

MetricBuilder builds metric record batches in a columnar Arrow format.

func NewMetricBuilder

func NewMetricBuilder(allocator memory.Allocator) *MetricBuilder

NewMetricBuilder creates a new MetricBuilder with the given memory allocator.

func (*MetricBuilder) Append

func (mb *MetricBuilder) Append(m *model.Metric)

Append appends a single metric data point to the builder. AttrHash() is called before writing attribute FKs to ensure consistent ordering.

func (*MetricBuilder) Build

func (mb *MetricBuilder) Build() []arrow.RecordBatch

Build builds and returns the [attribute, metric] record batches.

func (*MetricBuilder) Bytes

func (mb *MetricBuilder) Bytes() ([]byte, error)

Bytes serializes all pending metric rows into IPC bytes and resets internal state.

func (*MetricBuilder) NumOfRows

func (mb *MetricBuilder) NumOfRows() int

NumOfRows returns the number of metric rows appended so far.

func (*MetricBuilder) Release

func (mb *MetricBuilder) Release() error

Release releases all resources held by the MetricBuilder.

func (*MetricBuilder) Schemas

func (mb *MetricBuilder) Schemas() []*arrow.Schema

Schemas returns the schemas for the [attribute, metric] record batches.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads metric data from Arrow record batches.

func NewReader

func NewReader(data []byte) (*Reader, error)

NewReader creates a Reader by deserializing IPC bytes written by MetricBuilder.Bytes().

func (*Reader) AttrHash

func (r *Reader) AttrHash(row int) uint64

AttrHash returns the attribute set hash for the given row.

func (*Reader) Attributes

func (r *Reader) Attributes(row int, fn func(key, value string))

Attributes iterates over the attribute FK list for the given row, resolving each FK to a key-value pair from the attribute table and calling fn.

func (*Reader) Exemplars

func (r *Reader) Exemplars(row int, fn func(e *model.Exemplar))

Exemplars iterates over the List<ExemplarType> entries for the given row, calling fn for each exemplar (nil entries are skipped).

func (*Reader) Fields

func (r *Reader) Fields(row int, fn func(name string, kind field.Type, value float64))

Fields iterates over the List<Struct{name,kind,value}> entries for the given row, calling fn for each field. kind is the raw uint8 from the Arrow column, cast directly to field.Type — no string conversion needed.

func (*Reader) Name

func (r *Reader) Name(row int) string

Name returns the metric name string for the given row.

func (*Reader) Namespace

func (r *Reader) Namespace(row int) string

Namespace returns the namespace string for the given row (empty string if null).

func (*Reader) NumRows

func (r *Reader) NumRows() int

NumRows returns the number of metric rows in the current record batch.

func (*Reader) Release

func (r *Reader) Release()

Release releases all record batches and the underlying IPC reader.

func (*Reader) Reset

func (r *Reader) Reset(data []byte) error

Reset re-uses the reader with new IPC data, releasing old record batches.

func (*Reader) Timestamp

func (r *Reader) Timestamp(row int) int64

Timestamp returns the timestamp (nanoseconds) for the given row.

Directories

Path Synopsis
Package v1 provides the Arrow schema definition for version 1 of the metrics data structure.
Package v1 provides the Arrow schema definition for version 1 of the metrics data structure.

Jump to

Keyboard shortcuts

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