arrow

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package arrow contains types and functions used to convert OTLP metrics into their Arrow representation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DataPointSchema is the Arrow schema representing data points.
	// Related record.
	DataPointSchema = arrow.NewSchema([]arrow.Field{

		{Name: constants.ID, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.DeltaEncoding)},

		{Name: constants.ParentID, Type: arrow.PrimitiveTypes.Uint16},
		{Name: constants.StartTimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns},
		{Name: constants.TimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns},
		{Name: constants.IntValue, Type: arrow.PrimitiveTypes.Int64},
		{Name: constants.DoubleValue, Type: arrow.PrimitiveTypes.Float64},
		{Name: constants.Flags, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional)},
	}, nil)
)

EHistogramDataPointBucketsDT is the Arrow Data Type describing an exponential histogram data point buckets.

View Source
var (
	// EHistogramDataPointSchema is the Arrow schema describing a
	// histogram data point.
	// Related record.
	EHistogramDataPointSchema = arrow.NewSchema([]arrow.Field{

		{Name: constants.ID, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional, schema.DeltaEncoding)},

		{Name: constants.ParentID, Type: arrow.PrimitiveTypes.Uint16},
		{Name: constants.StartTimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.TimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramCount, Type: arrow.PrimitiveTypes.Uint64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramSum, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.ExpHistogramScale, Type: arrow.PrimitiveTypes.Int32, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.ExpHistogramZeroCount, Type: arrow.PrimitiveTypes.Uint64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.ExpHistogramPositive, Type: EHistogramDataPointBucketsDT, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.ExpHistogramNegative, Type: EHistogramDataPointBucketsDT, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.Flags, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramMin, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramMax, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
	}, nil)
)
View Source
var (
	ErrUnknownMetricType = errors.New("unknown metric type")
)
View Source
var (
	// ExemplarSchema is the Arrow schema representing an OTLP metric exemplar.
	ExemplarSchema = arrow.NewSchema([]arrow.Field{
		{Name: constants.ID, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional, schema.DeltaEncoding)},
		{Name: constants.ParentID, Type: arrow.PrimitiveTypes.Uint32},
		{Name: constants.TimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.IntValue, Type: arrow.PrimitiveTypes.Int64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.DoubleValue, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.SpanId, Type: &arrow.FixedSizeBinaryType{ByteWidth: 8}, Metadata: schema.Metadata(schema.Optional, schema.Dictionary8)},
		{Name: constants.TraceId, Type: &arrow.FixedSizeBinaryType{ByteWidth: 16}, Metadata: schema.Metadata(schema.Optional, schema.Dictionary8)},
	}, nil)
)
View Source
var (
	// HistogramDataPointSchema is the Arrow Schema describing a histogram
	// data point.
	// Related record.
	HistogramDataPointSchema = arrow.NewSchema([]arrow.Field{

		{Name: constants.ID, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional, schema.DeltaEncoding)},

		{Name: constants.ParentID, Type: arrow.PrimitiveTypes.Uint16},
		{Name: constants.StartTimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.TimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramCount, Type: arrow.PrimitiveTypes.Uint64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramSum, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramBucketCounts, Type: arrow.ListOf(arrow.PrimitiveTypes.Uint64), Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramExplicitBounds, Type: arrow.ListOf(arrow.PrimitiveTypes.Float64), Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.Flags, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramMin, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.HistogramMax, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
	}, nil)
)

MetricsSchema is the Arrow schema for the OTLP Arrow Metrics record.

View Source
var (
	QuantileValueDT = arrow.StructOf(
		arrow.Field{Name: constants.SummaryQuantile, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		arrow.Field{Name: constants.SummaryValue, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
	)
)

QuantileValueDT is the Arrow Data Type describing a quantile value.

View Source
var (
	// SummaryDataPointSchema is the Arrow Schema describing a summary
	// data point.
	// Related record.
	SummaryDataPointSchema = arrow.NewSchema([]arrow.Field{

		{Name: constants.ID, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional, schema.DeltaEncoding)},

		{Name: constants.ParentID, Type: arrow.PrimitiveTypes.Uint16},
		{Name: constants.StartTimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.TimeUnixNano, Type: arrow.FixedWidthTypes.Timestamp_ns, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.SummaryCount, Type: arrow.PrimitiveTypes.Uint64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.SummarySum, Type: arrow.PrimitiveTypes.Float64, Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.SummaryQuantileValues, Type: arrow.ListOf(QuantileValueDT), Metadata: schema.Metadata(schema.Optional)},
		{Name: constants.Flags, Type: arrow.PrimitiveTypes.Uint32, Metadata: schema.Metadata(schema.Optional)},
	}, nil)
)

Functions

This section is empty.

Types

type AttrsBuilders

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

AttrsBuilders groups together AttrsBuilder instances used to build related data attributes (i.e. resource attributes, scope attributes, metrics attributes.

func (*AttrsBuilders) Release

func (ab *AttrsBuilders) Release()

func (*AttrsBuilders) Reset

func (ab *AttrsBuilders) Reset()

func (*AttrsBuilders) Resource

func (ab *AttrsBuilders) Resource() *carrow.Attrs16Builder

func (*AttrsBuilders) Scope

func (ab *AttrsBuilders) Scope() *carrow.Attrs16Builder

type AttrsConfig

type AttrsConfig struct {
	Resource                *arrow.Attrs16Config
	Scope                   *arrow.Attrs16Config
	NumberDataPoint         *arrow.Attrs32Config
	NumberDataPointExemplar *arrow.Attrs32Config
	Summary                 *arrow.Attrs32Config
	Histogram               *arrow.Attrs32Config
	HistogramExemplar       *arrow.Attrs32Config
	ExpHistogram            *arrow.Attrs32Config
	ExpHistogramExemplar    *arrow.Attrs32Config
}

type Config

type Config struct {
	Global *cfg.Config

	Metric *MetricConfig

	NumberDP     *NumberDataPointConfig
	Summary      *SummaryConfig
	Histogram    *HistogramConfig
	ExpHistogram *ExpHistogramConfig

	NumberDataPointExemplar *ExemplarConfig
	HistogramExemplar       *ExemplarConfig
	ExpHistogramExemplar    *ExemplarConfig

	Attrs *AttrsConfig
}

func DefaultConfig

func DefaultConfig() *Config

func NewConfig

func NewConfig(globalConf *cfg.Config) *Config

func NewNoSortConfig

func NewNoSortConfig(globalConf *cfg.Config) *Config

type DP

type DP struct {
	ParentID uint16
	Orig     *pmetric.NumberDataPoint
}

DP is an internal representation of a data point used by the DPAccumulator.

type DPAccumulator

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

DPAccumulator is an accumulator for data points.

func NewDPAccumulator

func NewDPAccumulator(sorter NumberDataPointSorter) *DPAccumulator

NewDPAccumulator creates a new DPAccumulator.

func (*DPAccumulator) Append

func (a *DPAccumulator) Append(
	parentId uint16,
	dp *pmetric.NumberDataPoint,
)

Append appends a slice of number data points to the accumulator.

func (*DPAccumulator) IsEmpty

func (a *DPAccumulator) IsEmpty() bool

func (*DPAccumulator) Reset

func (a *DPAccumulator) Reset()

type DataPointBuilder

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

DataPointBuilder is a builder for int data points.

func NewDataPointBuilder

func NewDataPointBuilder(rBuilder *builder.RecordBuilderExt, payloadType *carrow.PayloadType, conf *NumberDataPointConfig) *DataPointBuilder

NewDataPointBuilder creates a new DataPointBuilder.

func (*DataPointBuilder) Accumulator

func (b *DataPointBuilder) Accumulator() *DPAccumulator

func (*DataPointBuilder) Build

func (b *DataPointBuilder) Build() (record arrow.Record, err error)

func (*DataPointBuilder) IsEmpty

func (b *DataPointBuilder) IsEmpty() bool

func (*DataPointBuilder) PayloadType

func (b *DataPointBuilder) PayloadType() *carrow.PayloadType

func (*DataPointBuilder) Release

func (b *DataPointBuilder) Release()

Release releases the underlying memory.

func (*DataPointBuilder) Reset

func (b *DataPointBuilder) Reset()

func (*DataPointBuilder) Schema

func (b *DataPointBuilder) Schema() *arrow.Schema

func (*DataPointBuilder) SchemaID

func (b *DataPointBuilder) SchemaID() string

func (*DataPointBuilder) SetAttributesAccumulator

func (b *DataPointBuilder) SetAttributesAccumulator(accu *carrow.Attributes32Accumulator)

func (*DataPointBuilder) SetExemplarAccumulator

func (b *DataPointBuilder) SetExemplarAccumulator(accu *ExemplarAccumulator)

func (*DataPointBuilder) TryBuild

func (b *DataPointBuilder) TryBuild(attrsAccu *carrow.Attributes32Accumulator) (record arrow.Record, err error)

type EHDP

type EHDP struct {
	ParentID uint16
	Orig     *pmetric.ExponentialHistogramDataPoint
}

type EHDPAccumulator

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

func NewEHDPAccumulator

func NewEHDPAccumulator(sorter EHistogramSorter) *EHDPAccumulator

func (*EHDPAccumulator) Append

func (a *EHDPAccumulator) Append(
	metricID uint16,
	ehdps pmetric.ExponentialHistogramDataPointSlice,
)

func (*EHDPAccumulator) IsEmpty

func (a *EHDPAccumulator) IsEmpty() bool

func (*EHDPAccumulator) Reset

func (a *EHDPAccumulator) Reset()

type EHistogramDataPointBucketsBuilder

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

EHistogramDataPointBucketsBuilder is a builder for exponential histogram data point buckets.

func EHistogramDataPointBucketsBuilderFrom

func EHistogramDataPointBucketsBuilderFrom(b *builder.StructBuilder) *EHistogramDataPointBucketsBuilder

EHistogramDataPointBucketsBuilderFrom creates a new EHistogramDataPointBucketsBuilder from an existing StructBuilder.

func (*EHistogramDataPointBucketsBuilder) Append

Append appends a new histogram data point to the builder.

func (*EHistogramDataPointBucketsBuilder) Build

Build builds the underlying array.

Once the array is no longer needed, Release() should be called to free the memory.

func (*EHistogramDataPointBucketsBuilder) Release

func (b *EHistogramDataPointBucketsBuilder) Release()

Release releases the underlying memory.

type EHistogramDataPointBuilder

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

EHistogramDataPointBuilder is a builder for exponential histogram data points.

func NewEHistogramDataPointBuilder

func NewEHistogramDataPointBuilder(rBuilder *builder.RecordBuilderExt, conf *ExpHistogramConfig) *EHistogramDataPointBuilder

NewEHistogramDataPointBuilder creates a new EHistogramDataPointBuilder.

func (*EHistogramDataPointBuilder) Accumulator

func (b *EHistogramDataPointBuilder) Accumulator() *EHDPAccumulator

func (*EHistogramDataPointBuilder) AppendCountSum

func (*EHistogramDataPointBuilder) AppendExemplars

func (*EHistogramDataPointBuilder) AppendMinMax

func (*EHistogramDataPointBuilder) Build

func (b *EHistogramDataPointBuilder) Build() (record arrow.Record, err error)

Build builds the underlying array.

Once the array is no longer needed, Release() should be called to free the memory.

func (*EHistogramDataPointBuilder) IsEmpty

func (b *EHistogramDataPointBuilder) IsEmpty() bool

func (*EHistogramDataPointBuilder) PayloadType

func (b *EHistogramDataPointBuilder) PayloadType() *carrow.PayloadType

func (*EHistogramDataPointBuilder) Release

func (b *EHistogramDataPointBuilder) Release()

Release releases the underlying memory.

func (*EHistogramDataPointBuilder) Reset

func (b *EHistogramDataPointBuilder) Reset()

func (*EHistogramDataPointBuilder) Schema

func (*EHistogramDataPointBuilder) SchemaID

func (b *EHistogramDataPointBuilder) SchemaID() string

func (*EHistogramDataPointBuilder) SetAttributesAccumulator

func (b *EHistogramDataPointBuilder) SetAttributesAccumulator(accu *carrow.Attributes32Accumulator)

func (*EHistogramDataPointBuilder) SetExemplarAccumulator

func (b *EHistogramDataPointBuilder) SetExemplarAccumulator(accu *ExemplarAccumulator)

func (*EHistogramDataPointBuilder) TryBuild

func (b *EHistogramDataPointBuilder) TryBuild(attrsAccu *carrow.Attributes32Accumulator) (record arrow.Record, err error)

type EHistogramSorter

type EHistogramSorter interface {
	Sort(histograms []EHDP)
	Encode(parentID uint16, dp *pmetric.ExponentialHistogramDataPoint) uint16
	Reset()
}

type EHistogramsByNothing

type EHistogramsByNothing struct{}

func UnsortedEHistograms

func UnsortedEHistograms() *EHistogramsByNothing

func (*EHistogramsByNothing) Encode

func (*EHistogramsByNothing) Reset

func (a *EHistogramsByNothing) Reset()

func (*EHistogramsByNothing) Sort

func (a *EHistogramsByNothing) Sort(_ []EHDP)

type EHistogramsByParentID

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

func SortEHistogramsByParentID

func SortEHistogramsByParentID() *EHistogramsByParentID

func (*EHistogramsByParentID) Encode

func (*EHistogramsByParentID) Reset

func (a *EHistogramsByParentID) Reset()

func (*EHistogramsByParentID) Sort

func (a *EHistogramsByParentID) Sort(histograms []EHDP)

type Exemplar

type Exemplar struct {
	ParentID uint32
	Orig     *pmetric.Exemplar
}

type ExemplarAccumulator

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

func NewExemplarAccumulator

func NewExemplarAccumulator(sorter ExemplarSorter) *ExemplarAccumulator

func (*ExemplarAccumulator) Append

func (a *ExemplarAccumulator) Append(dpID uint32, exemplars pmetric.ExemplarSlice) error

Append appends a slice of exemplars to the accumulator.

func (*ExemplarAccumulator) IsEmpty

func (a *ExemplarAccumulator) IsEmpty() bool

func (*ExemplarAccumulator) Reset

func (a *ExemplarAccumulator) Reset()

type ExemplarBuilder

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

ExemplarBuilder is a helper to build an Arrow array containing a collection of OTLP metric exemplar.

func NewExemplarBuilder

func NewExemplarBuilder(rBuilder *builder.RecordBuilderExt, payloadType *carrow.PayloadType, conf *ExemplarConfig) *ExemplarBuilder

NewExemplarBuilder creates a new ExemplarBuilder.

func (*ExemplarBuilder) Accumulator

func (b *ExemplarBuilder) Accumulator() *ExemplarAccumulator

func (*ExemplarBuilder) Build

func (b *ExemplarBuilder) Build() (record arrow.Record, err error)

func (*ExemplarBuilder) IsEmpty

func (b *ExemplarBuilder) IsEmpty() bool

func (*ExemplarBuilder) PayloadType

func (b *ExemplarBuilder) PayloadType() *carrow.PayloadType

func (*ExemplarBuilder) Release

func (b *ExemplarBuilder) Release()

Release releases the memory allocated by the builder.

func (*ExemplarBuilder) Reset

func (b *ExemplarBuilder) Reset()

func (*ExemplarBuilder) Schema

func (b *ExemplarBuilder) Schema() *arrow.Schema

func (*ExemplarBuilder) SchemaID

func (b *ExemplarBuilder) SchemaID() string

func (*ExemplarBuilder) SetAttributesAccumulator

func (b *ExemplarBuilder) SetAttributesAccumulator(accu *carrow.Attributes32Accumulator)

func (*ExemplarBuilder) TryBuild

func (b *ExemplarBuilder) TryBuild(attrsAccu *carrow.Attributes32Accumulator) (record arrow.Record, err error)

type ExemplarConfig

type ExemplarConfig struct {
	Sorter ExemplarSorter
}

type ExemplarParentIdEncoder

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

func NewExemplarParentIdEncoder

func NewExemplarParentIdEncoder(encoderType int) *ExemplarParentIdEncoder

func (*ExemplarParentIdEncoder) Encode

func (e *ExemplarParentIdEncoder) Encode(parentID uint32) uint32

type ExemplarSorter

type ExemplarSorter interface {
	Sort(exemplars []Exemplar)
	Encode(parentID uint32, dp *pmetric.Exemplar) uint32
	Reset()
}

type ExemplarsByNothing

type ExemplarsByNothing struct{}

func UnsortedExemplars

func UnsortedExemplars() *ExemplarsByNothing

func (*ExemplarsByNothing) Encode

func (s *ExemplarsByNothing) Encode(parentID uint32, _ *pmetric.Exemplar) uint32

func (*ExemplarsByNothing) Reset

func (s *ExemplarsByNothing) Reset()

func (*ExemplarsByNothing) Sort

func (s *ExemplarsByNothing) Sort(_ []Exemplar)

type ExemplarsByTypeValueParentId

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

func SortExemplarsByTypeValueParentId

func SortExemplarsByTypeValueParentId() *ExemplarsByTypeValueParentId

func (*ExemplarsByTypeValueParentId) Encode

func (s *ExemplarsByTypeValueParentId) Encode(parentID uint32, exemplar *pmetric.Exemplar) uint32

func (*ExemplarsByTypeValueParentId) Equal

func (s *ExemplarsByTypeValueParentId) Equal(ex1, ex2 *pmetric.Exemplar) bool

func (*ExemplarsByTypeValueParentId) Reset

func (s *ExemplarsByTypeValueParentId) Reset()

func (*ExemplarsByTypeValueParentId) Sort

func (s *ExemplarsByTypeValueParentId) Sort(exemplars []Exemplar)

type ExpHistogramConfig

type ExpHistogramConfig struct {
	Sorter EHistogramSorter
}

type FlattenedMetric

type FlattenedMetric struct {
	// Resource metrics section.
	ResourceMetricsID string
	Resource          pcommon.Resource
	ResourceSchemaUrl string

	// Scope metrics section.
	ScopeMetricsID string
	Scope          pcommon.InstrumentationScope
	ScopeSchemaUrl string

	// Metric section.
	Metric pmetric.Metric
}

type HDP

type HDP struct {
	ParentID uint16
	Orig     *pmetric.HistogramDataPoint
}

type HDPAccumulator

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

func NewHDPAccumulator

func NewHDPAccumulator(sorter HistogramSorter) *HDPAccumulator

func (*HDPAccumulator) Append

func (a *HDPAccumulator) Append(
	parentID uint16,
	hdps pmetric.HistogramDataPointSlice,
)

func (*HDPAccumulator) IsEmpty

func (a *HDPAccumulator) IsEmpty() bool

func (*HDPAccumulator) Reset

func (a *HDPAccumulator) Reset()

type HistogramConfig

type HistogramConfig struct {
	Sorter HistogramSorter
}

type HistogramDataPointBuilder

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

HistogramDataPointBuilder is a builder for histogram data points.

func NewHistogramDataPointBuilder

func NewHistogramDataPointBuilder(rBuilder *builder.RecordBuilderExt, conf *HistogramConfig) *HistogramDataPointBuilder

NewHistogramDataPointBuilder creates a new HistogramDataPointBuilder.

func (*HistogramDataPointBuilder) Accumulator

func (b *HistogramDataPointBuilder) Accumulator() *HDPAccumulator

func (*HistogramDataPointBuilder) Build

func (b *HistogramDataPointBuilder) Build() (record arrow.Record, err error)

Build builds the underlying array.

Once the array is no longer needed, Release() should be called to free the memory.

func (*HistogramDataPointBuilder) IsEmpty

func (b *HistogramDataPointBuilder) IsEmpty() bool

func (*HistogramDataPointBuilder) PayloadType

func (b *HistogramDataPointBuilder) PayloadType() *carrow.PayloadType

func (*HistogramDataPointBuilder) Release

func (b *HistogramDataPointBuilder) Release()

Release releases the underlying memory.

func (*HistogramDataPointBuilder) Reset

func (b *HistogramDataPointBuilder) Reset()

func (*HistogramDataPointBuilder) Schema

func (b *HistogramDataPointBuilder) Schema() *arrow.Schema

func (*HistogramDataPointBuilder) SchemaID

func (b *HistogramDataPointBuilder) SchemaID() string

func (*HistogramDataPointBuilder) SetAttributesAccumulator

func (b *HistogramDataPointBuilder) SetAttributesAccumulator(accu *carrow.Attributes32Accumulator)

func (*HistogramDataPointBuilder) SetExemplarAccumulator

func (b *HistogramDataPointBuilder) SetExemplarAccumulator(accu *ExemplarAccumulator)

func (*HistogramDataPointBuilder) TryBuild

func (b *HistogramDataPointBuilder) TryBuild(attrsAccu *carrow.Attributes32Accumulator) (record arrow.Record, err error)

type HistogramSorter

type HistogramSorter interface {
	Sort(histograms []HDP)
	Encode(parentID uint16, dp *pmetric.HistogramDataPoint) uint16
	Reset()
}

type HistogramsByNothing

type HistogramsByNothing struct{}

func UnsortedHistograms

func UnsortedHistograms() *HistogramsByNothing

func (*HistogramsByNothing) Encode

func (*HistogramsByNothing) Reset

func (a *HistogramsByNothing) Reset()

func (*HistogramsByNothing) Sort

func (a *HistogramsByNothing) Sort(_ []HDP)

type HistogramsByParentID

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

func SortHistogramsByParentID

func SortHistogramsByParentID() *HistogramsByParentID

func (*HistogramsByParentID) Encode

func (*HistogramsByParentID) Reset

func (a *HistogramsByParentID) Reset()

func (*HistogramsByParentID) Sort

func (a *HistogramsByParentID) Sort(histograms []HDP)

type MetricConfig

type MetricConfig struct {
	Sorter MetricSorter
}

type MetricSorter

type MetricSorter interface {
	Sort(metrics []*FlattenedMetric)
}

type MetricsAnalyzer

type MetricsAnalyzer struct {
	MetricCount          int64
	ResourceMetricsStats *ResourceMetricsStats
}

func NewMetricsAnalyzer

func NewMetricsAnalyzer() *MetricsAnalyzer

func (*MetricsAnalyzer) Analyze

func (t *MetricsAnalyzer) Analyze(metrics *MetricsOptimized)

func (*MetricsAnalyzer) ShowStats

func (t *MetricsAnalyzer) ShowStats(indent string)

type MetricsBuilder

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

MetricsBuilder is a helper to build a list of resource metrics.

func NewMetricsBuilder

func NewMetricsBuilder(
	rBuilder *builder.RecordBuilderExt,
	cfg *Config,
	stats *stats.ProducerStats,
) (*MetricsBuilder, error)

NewMetricsBuilder creates a new MetricsBuilder.

Important Note: The rBuilder parameter will not be released by this MetricsBuilder as it's shared with other instances of metrics builders.

func (*MetricsBuilder) Append

func (b *MetricsBuilder) Append(metrics pmetric.Metrics) error

Append appends a new set of resource metrics to the builder.

func (*MetricsBuilder) Build

func (b *MetricsBuilder) Build() (record arrow.Record, err error)

Build builds an Arrow Record from the builder.

Once the array is no longer needed, Release() must be called to free the memory allocated by the record.

func (*MetricsBuilder) RecordBuilderExt

func (b *MetricsBuilder) RecordBuilderExt() *builder.RecordBuilderExt

func (*MetricsBuilder) RelatedData

func (b *MetricsBuilder) RelatedData() *RelatedData

func (*MetricsBuilder) Release

func (b *MetricsBuilder) Release()

Release releases the memory allocated by the builder.

func (*MetricsBuilder) ShowSchema

func (b *MetricsBuilder) ShowSchema()

type MetricsByNothing

type MetricsByNothing struct{}

func UnsortedMetrics

func UnsortedMetrics() *MetricsByNothing

func (*MetricsByNothing) Sort

func (s *MetricsByNothing) Sort(_ []*FlattenedMetric)

type MetricsByResourceScopeTypeName

type MetricsByResourceScopeTypeName struct{}

func SortMetricsByResourceScopeTypeName

func SortMetricsByResourceScopeTypeName() *MetricsByResourceScopeTypeName

func (*MetricsByResourceScopeTypeName) Sort

func (s *MetricsByResourceScopeTypeName) Sort(metrics []*FlattenedMetric)

type MetricsByTypeNameResourceScope

type MetricsByTypeNameResourceScope struct{}

func SortMetricsByTypeNameResourceScope

func SortMetricsByTypeNameResourceScope() *MetricsByTypeNameResourceScope

func (*MetricsByTypeNameResourceScope) Sort

func (s *MetricsByTypeNameResourceScope) Sort(metrics []*FlattenedMetric)

type MetricsOptimized

type MetricsOptimized struct {
	Metrics []*FlattenedMetric
}

type MetricsOptimizer

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

func NewMetricsOptimizer

func NewMetricsOptimizer(sorter MetricSorter) *MetricsOptimizer

func (*MetricsOptimizer) Optimize

func (t *MetricsOptimizer) Optimize(metrics pmetric.Metrics) *MetricsOptimized

type MetricsStats

type MetricsStats struct {
	TotalCount        int64
	Distribution      *hdrhistogram.Histogram
	Attributes        *carrow.AttributesStats
	SharedAttributes  *carrow.AttributesStats
	TimeIntervalStats *carrow.TimeIntervalStats
	Name              *carrow.StringStats
	SpanID            *hyperloglog.Sketch
	TraceID           *hyperloglog.Sketch
	ParentSpanID      *hyperloglog.Sketch
	Kind              *hyperloglog.Sketch
	TraceState        *hyperloglog.Sketch
	StatusStats       *carrow.StatusStats
}

func NewMetricsStats

func NewMetricsStats() *MetricsStats

func (*MetricsStats) ShowStats

func (s *MetricsStats) ShowStats(indent string)

type NumberDataPointConfig

type NumberDataPointConfig struct {
	Sorter NumberDataPointSorter
}

type NumberDataPointSorter

type NumberDataPointSorter interface {
	Sort(dps []DP)
	Encode(parentID uint16, dp *pmetric.NumberDataPoint) uint16
	Reset()
}

type NumberDataPointsByNothing

type NumberDataPointsByNothing struct{}

func UnsortedNumberDataPoints

func UnsortedNumberDataPoints() *NumberDataPointsByNothing

func (*NumberDataPointsByNothing) Encode

func (*NumberDataPointsByNothing) Reset

func (a *NumberDataPointsByNothing) Reset()

func (*NumberDataPointsByNothing) Sort

func (a *NumberDataPointsByNothing) Sort(_ []DP)

type NumberDataPointsByParentID

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

func SortNumberDataPointsByParentID

func SortNumberDataPointsByParentID() *NumberDataPointsByParentID

func (*NumberDataPointsByParentID) Encode

func (*NumberDataPointsByParentID) Reset

func (a *NumberDataPointsByParentID) Reset()

func (*NumberDataPointsByParentID) Sort

func (a *NumberDataPointsByParentID) Sort(dps []DP)

type NumberDataPointsByTimestampParentID

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

func SortNumberDataPointsByTimeParentID

func SortNumberDataPointsByTimeParentID() *NumberDataPointsByTimestampParentID

func (*NumberDataPointsByTimestampParentID) Encode

func (*NumberDataPointsByTimestampParentID) Reset

func (*NumberDataPointsByTimestampParentID) Sort

func (a *NumberDataPointsByTimestampParentID) Sort(dps []DP)

type NumberDataPointsByTimestampParentIDTypeValue

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

func SortNumberDataPointsByTimeParentIDTypeValue

func SortNumberDataPointsByTimeParentIDTypeValue() *NumberDataPointsByTimestampParentIDTypeValue

func (*NumberDataPointsByTimestampParentIDTypeValue) Encode

func (*NumberDataPointsByTimestampParentIDTypeValue) Reset

func (*NumberDataPointsByTimestampParentIDTypeValue) Sort

type NumberDataPointsByTimestampTypeValueParentID

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

func SortNumberDataPointsByTimestampTypeValueParentID

func SortNumberDataPointsByTimestampTypeValueParentID() *NumberDataPointsByTimestampTypeValueParentID

func (*NumberDataPointsByTimestampTypeValueParentID) Encode

func (*NumberDataPointsByTimestampTypeValueParentID) Equal

func (*NumberDataPointsByTimestampTypeValueParentID) Reset

func (*NumberDataPointsByTimestampTypeValueParentID) Sort

type NumberDataPointsByTypeValueTimestampParentID

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

func SortNumberDataPointsByTypeValueTimestampParentID

func SortNumberDataPointsByTypeValueTimestampParentID() *NumberDataPointsByTypeValueTimestampParentID

func (*NumberDataPointsByTypeValueTimestampParentID) Encode

func (*NumberDataPointsByTypeValueTimestampParentID) Equal

func (*NumberDataPointsByTypeValueTimestampParentID) Reset

func (*NumberDataPointsByTypeValueTimestampParentID) Sort

type QuantileValueBuilder

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

QuantileValueBuilder is a builder for a quantile value.

func QuantileValueBuilderFrom

func QuantileValueBuilderFrom(ndpb *builder.StructBuilder) *QuantileValueBuilder

QuantileValueBuilderFrom creates a new QuantileValueBuilder from an existing StructBuilder.

func (*QuantileValueBuilder) Append

Append appends a new quantile value to the builder.

func (*QuantileValueBuilder) Build

func (b *QuantileValueBuilder) Build() (*array.Struct, error)

Build builds the underlying array.

Once the array is no longer needed, Release() should be called to free the memory.

func (*QuantileValueBuilder) Release

func (b *QuantileValueBuilder) Release()

Release releases the underlying memory.

type RelatedData

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

RelatedData is a collection of related/dependent data to metrics entities.

func NewRelatedData

func NewRelatedData(cfg *Config, stats *stats.ProducerStats) (*RelatedData, error)

func (*RelatedData) AttrsBuilders

func (r *RelatedData) AttrsBuilders() *AttrsBuilders

func (*RelatedData) BuildRecordMessages

func (r *RelatedData) BuildRecordMessages() ([]*record_message.RecordMessage, error)

func (*RelatedData) EHistogramDPBuilder

func (r *RelatedData) EHistogramDPBuilder() *EHistogramDataPointBuilder

func (*RelatedData) EHistogramExemplarBuilder

func (r *RelatedData) EHistogramExemplarBuilder() *ExemplarBuilder

func (*RelatedData) HistogramDPBuilder

func (r *RelatedData) HistogramDPBuilder() *HistogramDataPointBuilder

func (*RelatedData) HistogramExemplarBuilder

func (r *RelatedData) HistogramExemplarBuilder() *ExemplarBuilder

func (*RelatedData) NextMetricScopeID

func (r *RelatedData) NextMetricScopeID() uint16

func (*RelatedData) NumberDPBuilder

func (r *RelatedData) NumberDPBuilder() *DataPointBuilder

func (*RelatedData) NumberDPExemplarBuilder

func (r *RelatedData) NumberDPExemplarBuilder() *ExemplarBuilder

func (*RelatedData) RecordBuilderExt

func (r *RelatedData) RecordBuilderExt(payloadType *carrow.PayloadType) *builder.RecordBuilderExt

func (*RelatedData) Release

func (r *RelatedData) Release()

func (*RelatedData) Reset

func (r *RelatedData) Reset()

func (*RelatedData) Schemas

func (r *RelatedData) Schemas() []carrow.SchemaWithPayload

func (*RelatedData) SummaryDPBuilder

func (r *RelatedData) SummaryDPBuilder() *SummaryDataPointBuilder

type ResourceMetricsStats

type ResourceMetricsStats struct {
	TotalCount            int64
	Distribution          *hdrhistogram.Histogram
	ResMetricsIDsDistinct *hyperloglog.Sketch
	ResourceStats         *carrow.ResourceStats
	ScopeMetricsStats     *ScopeMetricsStats
	SchemaUrlStats        *carrow.SchemaUrlStats
}

func (*ResourceMetricsStats) ShowStats

func (r *ResourceMetricsStats) ShowStats(indent string)

func (*ResourceMetricsStats) UpdateWith

func (r *ResourceMetricsStats) UpdateWith(metrics *MetricsOptimized)

type ScopeMetricsStats

type ScopeMetricsStats struct {
	Distribution            *hdrhistogram.Histogram
	ScopeMetricsIDsDistinct *hyperloglog.Sketch
	ScopeStats              *carrow.ScopeStats
	SchemaUrlStats          *carrow.SchemaUrlStats
	MetricsStats            *MetricsStats
}

func (*ScopeMetricsStats) ShowStats

func (s *ScopeMetricsStats) ShowStats(indent string)

type SummariesByNothing

type SummariesByNothing struct{}

func UnsortedSummaries

func UnsortedSummaries() *SummariesByNothing

func (*SummariesByNothing) Encode

func (a *SummariesByNothing) Encode(parentID uint16, _ *pmetric.SummaryDataPoint) uint16

func (*SummariesByNothing) Reset

func (a *SummariesByNothing) Reset()

func (*SummariesByNothing) Sort

func (a *SummariesByNothing) Sort(_ []Summary)

type SummariesByParentID

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

func SortSummariesByParentID

func SortSummariesByParentID() *SummariesByParentID

func (*SummariesByParentID) Encode

func (a *SummariesByParentID) Encode(parentID uint16, _ *pmetric.SummaryDataPoint) uint16

func (*SummariesByParentID) Reset

func (a *SummariesByParentID) Reset()

func (*SummariesByParentID) Sort

func (a *SummariesByParentID) Sort(summaries []Summary)

type Summary

type Summary struct {
	ParentID uint16
	Orig     *pmetric.SummaryDataPoint
}

type SummaryAccumulator

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

func NewSummaryAccumulator

func NewSummaryAccumulator(sorter SummarySorter) *SummaryAccumulator

NewSummaryAccumulator creates a new SummaryAccumulator.

func (*SummaryAccumulator) Append

func (a *SummaryAccumulator) Append(
	parentID uint16,
	summaries pmetric.SummaryDataPointSlice,
)

Append appends a slice of number data points to the accumulator.

func (*SummaryAccumulator) IsEmpty

func (a *SummaryAccumulator) IsEmpty() bool

func (*SummaryAccumulator) Reset

func (a *SummaryAccumulator) Reset()

type SummaryConfig

type SummaryConfig struct {
	Sorter SummarySorter
}

type SummaryDataPointBuilder

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

SummaryDataPointBuilder is a builder for a summary data point.

func NewSummaryDataPointBuilder

func NewSummaryDataPointBuilder(rBuilder *builder.RecordBuilderExt, conf *SummaryConfig) *SummaryDataPointBuilder

NewSummaryDataPointBuilder creates a new SummaryDataPointBuilder.

func (*SummaryDataPointBuilder) Accumulator

func (b *SummaryDataPointBuilder) Accumulator() *SummaryAccumulator

func (*SummaryDataPointBuilder) Build

func (b *SummaryDataPointBuilder) Build() (record arrow.Record, err error)

Build builds the underlying array.

Once the array is no longer needed, Release() should be called to free the memory.

func (*SummaryDataPointBuilder) IsEmpty

func (b *SummaryDataPointBuilder) IsEmpty() bool

func (*SummaryDataPointBuilder) PayloadType

func (b *SummaryDataPointBuilder) PayloadType() *carrow.PayloadType

func (*SummaryDataPointBuilder) Release

func (b *SummaryDataPointBuilder) Release()

Release releases the underlying memory.

func (*SummaryDataPointBuilder) Reset

func (b *SummaryDataPointBuilder) Reset()

func (*SummaryDataPointBuilder) Schema

func (b *SummaryDataPointBuilder) Schema() *arrow.Schema

func (*SummaryDataPointBuilder) SchemaID

func (b *SummaryDataPointBuilder) SchemaID() string

func (*SummaryDataPointBuilder) SetAttributesAccumulator

func (b *SummaryDataPointBuilder) SetAttributesAccumulator(accu *carrow.Attributes32Accumulator)

func (*SummaryDataPointBuilder) TryBuild

func (b *SummaryDataPointBuilder) TryBuild(attrsAccu *carrow.Attributes32Accumulator) (record arrow.Record, err error)

type SummarySorter

type SummarySorter interface {
	Sort(summaries []Summary)
	Encode(parentID uint16, summary *pmetric.SummaryDataPoint) uint16
	Reset()
}

Jump to

Keyboard shortcuts

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