reader

package
v0.0.0-...-2d6f5b3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package reader implements an iterator over encoded dogstatsd http payload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricDataReader

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

MetricDataReader is an iterator over data contained in MetricData part of the payload.

Usage:

r := NewMetricDataReader(payload.MetricData)
if err := r.Initialize(); err != nil {
    return err
}
for r.HaveMoreMetrics() {
    if err := r.NextMetric(); err != nil {
        return err
    }
    // Accessors for metric entry data can be called.
    for r.HaveMorePoints() {
        if err := r.NextPoint(); err != nil {
            return err
        }
        // Acessors for metric data point can be called.
    }
}

func NewMetricDataReader

func NewMetricDataReader(data *pb.MetricData) *MetricDataReader

NewMetricDataReader creates new reader from data.

func (*MetricDataReader) HaveMoreMetrics

func (r *MetricDataReader) HaveMoreMetrics() bool

HaveMoreMetrics returns true if there are more metrics to read.

func (*MetricDataReader) HaveMorePoints

func (r *MetricDataReader) HaveMorePoints() bool

HaveMorePoints returns true if there are more points to read.

func (*MetricDataReader) Initialize

func (r *MetricDataReader) Initialize() error

Initialize reads and normalizes payload dictionaries for fast access.

func (*MetricDataReader) Interval

func (r *MetricDataReader) Interval() uint64

Interval returns metric time interval for current metric entry.

func (*MetricDataReader) Name

func (r *MetricDataReader) Name() string

Name returns metric name of current metric entry.

func (*MetricDataReader) NextMetric

func (r *MetricDataReader) NextMetric() error

NextMetric consumes next metric entry and prepares data for access.

If this method returns an error the reader is in an invalid state and calling data access methods may panic.

func (*MetricDataReader) NextPoint

func (r *MetricDataReader) NextPoint() error

NextPoint consumes next urnead metric data point and prepares data for access.

If this method returns an error the reader is in an invalid state and calling data access methods may panic.

func (*MetricDataReader) NumPoints

func (r *MetricDataReader) NumPoints() uint64

NumPoints returns number of data points contained in the current metric entry.

func (*MetricDataReader) Origin

func (r *MetricDataReader) Origin() *originInfo

Origin returns product origin information for current metric entry.

func (*MetricDataReader) Resources

func (r *MetricDataReader) Resources() []*resource

Resources returns set of resources for current metric entry.

func (*MetricDataReader) SketchCols

func (r *MetricDataReader) SketchCols() (k []int32, n []uint32)

SketchCols returns sketch data columns for the current metric data point.

Only valid if r.Type() == MetricType_Sketch, panics otherwise.

func (*MetricDataReader) SketchNumBins

func (r *MetricDataReader) SketchNumBins() int

SketchNumBins returns number of sketch bins for the current metric data point.

Only valid if r.Type() == MetricType_Sketch, panics otherwise.

func (*MetricDataReader) SketchSummary

func (r *MetricDataReader) SketchSummary() (sum, min, max float64, cnt uint64)

SketchSummary returns sketch summary for current metric data point.

Only valid if r.Type() == MetricType_Sketch, panics otherwise.

func (*MetricDataReader) SourceTypeName

func (r *MetricDataReader) SourceTypeName() string

SourceTypeName returns source type identifier for current metric entry.

func (*MetricDataReader) Tags

func (r *MetricDataReader) Tags() []string

Tags returns set of tags for current metric entry.

func (*MetricDataReader) Timestamp

func (r *MetricDataReader) Timestamp() int64

Timestamp returns timestamp for current metric data point.

func (*MetricDataReader) Type

func (r *MetricDataReader) Type() pb.MetricType

Type returns type of current metric entry.

func (*MetricDataReader) Value

func (r *MetricDataReader) Value() float64

Value returns metric value for current metric data point.

Only valid to call if r.Type() != MetricType_Sketch, panics otherwise.

func (*MetricDataReader) ValueType

func (r *MetricDataReader) ValueType() pb.ValueType

Jump to

Keyboard shortcuts

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