transform

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package transform provides transformation functionality from the sdk/metric/metricdata data-types into OTLP data-types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrIter

func AttrIter(iter attribute.Iterator) []*cpb.KeyValue

AttrIter transforms an attribute iterator into OTLP key-values.

func DataPoints

func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint

DataPoints returns a slice of OTLP NumberDataPoint generated from dPts.

func Exemplars added in v1.24.0

func Exemplars[N int64 | float64](exemplars []metricdata.Exemplar[N]) []*mpb.Exemplar

Exemplars returns a slice of OTLP Exemplars generated from exemplars.

func ExponentialHistogram

ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is returned if the temporality of h is unknown.

func ExponentialHistogramDataPointBuckets

func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets

ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated from bucket.

func ExponentialHistogramDataPoints

func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint

ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated from dPts.

func Gauge

func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge

Gauge returns an OTLP Metric_Gauge generated from g.

func Histogram

func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error)

Histogram returns an OTLP Metric_Histogram generated from h. An error is returned if the temporality of h is unknown.

func HistogramDataPoints

func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint

HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated from dPts.

func KeyValue

func KeyValue(kv attribute.KeyValue) *cpb.KeyValue

KeyValue transforms an attribute KeyValue into an OTLP key-value.

func KeyValues

func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue

KeyValues transforms a slice of attribute KeyValues into OTLP key-values.

func Metrics

func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error)

Metrics returns a slice of OTLP Metric generated from ms. If ms contains invalid metric values, an error will be returned along with a slice that contains partial OTLP Metrics.

func QuantileValues added in v1.25.0

func QuantileValues(quantiles []metricdata.QuantileValue) []*mpb.SummaryDataPoint_ValueAtQuantile

QuantileValues returns a slice of OTLP SummaryDataPoint_ValueAtQuantile generated from quantiles.

func ResourceMetrics

func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error)

ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm contains invalid ScopeMetrics, an error will be returned along with an OTLP ResourceMetrics that contains partial OTLP ScopeMetrics.

func ScopeMetrics

func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error)

ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If sms contains invalid metric values, an error will be returned along with a slice that contains partial OTLP ScopeMetrics.

func Sum

func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error)

Sum returns an OTLP Metric_Sum generated from s. An error is returned if the temporality of s is unknown.

func Summary added in v1.25.0

Summary returns an OTLP Metric_Summary generated from s.

func SummaryDataPoints added in v1.25.0

func SummaryDataPoints(dPts []metricdata.SummaryDataPoint) []*mpb.SummaryDataPoint

SummaryDataPoints returns a slice of OTLP SummaryDataPoint generated from dPts.

func Temporality

Temporality returns an OTLP AggregationTemporality generated from t. If t is unknown, an error is returned along with the invalid AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED.

func Value

func Value(v attribute.Value) *cpb.AnyValue

Value transforms an attribute Value into an OTLP AnyValue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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