translator

package
v0.19.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	TimeSeriesConsumer
	SketchConsumer
}

Consumer is a metrics consumer.

type HistogramMode

type HistogramMode string

HistogramMode is an export mode for OTLP Histogram metrics.

const (
	// HistogramModeNoBuckets disables bucket export.
	HistogramModeNoBuckets HistogramMode = "nobuckets"
	// HistogramModeCounters exports buckets as Datadog counts.
	HistogramModeCounters HistogramMode = "counters"
	// HistogramModeDistributions exports buckets as Datadog distributions.
	HistogramModeDistributions HistogramMode = "distributions"
)

type HostConsumer

type HostConsumer interface {
	// ConsumeHost consumes a hostname.
	ConsumeHost(host string)
}

HostConsumer is a hostname consumer. It is an optional interface that can be implemented by a Consumer.

type HostnameProvider

type HostnameProvider interface {
	// Hostname gets the hostname from the machine.
	Hostname(ctx context.Context) (string, error)
}

HostnameProvider gets a hostname

type MetricDataType

type MetricDataType int

MetricDataType is a timeseries-style metric type.

const (
	// Gauge is the Datadog Gauge metric type.
	Gauge MetricDataType = iota
	// Count is the Datadog Count metric type.
	Count
)

type NumberMode

type NumberMode string

NumberMode is an export mode for OTLP Number metrics.

const (
	// NumberModeCumulativeToDelta calculates delta for
	// cumulative monotonic metrics in the client side and reports
	// them as Datadog counts.
	NumberModeCumulativeToDelta NumberMode = "cumulative_to_delta"

	// NumberModeRawValue reports the raw value for cumulative monotonic
	// metrics as a Datadog gauge.
	NumberModeRawValue NumberMode = "raw_value"
)

type Option

type Option func(*translatorConfig) error

Option is a translator creation option.

func WithCountSumMetrics

func WithCountSumMetrics() Option

WithCountSumMetrics exports .count and .sum histogram metrics.

func WithDeltaTTL

func WithDeltaTTL(deltaTTL int64) Option

WithDeltaTTL sets the delta TTL for cumulative metrics datapoints. By default, 3600 seconds are used.

func WithFallbackHostnameProvider

func WithFallbackHostnameProvider(provider HostnameProvider) Option

WithFallbackHostnameProvider sets the fallback hostname provider. By default, an empty hostname is used as a fallback.

func WithHistogramMode

func WithHistogramMode(mode HistogramMode) Option

WithHistogramMode sets the histograms mode. The default mode is HistogramModeOff.

func WithInstrumentationLibraryMetadataAsTags

func WithInstrumentationLibraryMetadataAsTags() Option

WithInstrumentationLibraryMetadataAsTags sets instrumentation library metadata as tags.

func WithNumberMode

func WithNumberMode(mode NumberMode) Option

WithNumberMode sets the number mode. The default mode is NumberModeCumulativeToDelta.

func WithQuantiles

func WithQuantiles() Option

WithQuantiles enables quantiles exporting for summary metrics.

func WithResourceAttributesAsTags

func WithResourceAttributesAsTags() Option

WithResourceAttributesAsTags sets resource attributes as tags.

type SketchConsumer

type SketchConsumer interface {
	// ConsumeSketch consumes a pkg/quantile-style sketch.
	ConsumeSketch(
		ctx context.Context,
		name string,
		timestamp uint64,
		sketch *quantile.Sketch,
		tags []string,
		host string,
	)
}

SketchConsumer is a pkg/quantile sketch consumer.

type TimeSeriesConsumer

type TimeSeriesConsumer interface {
	// ConsumeTimeSeries consumes a timeseries-style metric.
	ConsumeTimeSeries(
		ctx context.Context,
		name string,
		typ MetricDataType,
		timestamp uint64,
		value float64,
		tags []string,
		host string,
	)
}

TimeSeriesConsumer is timeseries consumer.

type Translator

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

Translator is a metrics translator.

func New

func New(logger *zap.Logger, options ...Option) (*Translator, error)

New creates a new translator with given options.

func (*Translator) MapMetrics

func (t *Translator) MapMetrics(ctx context.Context, md pdata.Metrics, consumer Consumer) error

MapMetrics maps OTLP metrics into the DataDog format

Jump to

Keyboard shortcuts

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