translator

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 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 added in v0.38.0

type Consumer interface {
	TimeSeriesConsumer
	SketchConsumer
}

Consumer is a metrics consumer.

type HistogramMode added in v0.37.0

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 added in v0.38.0

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 added in v0.38.0

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 added in v0.37.0

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 added in v0.37.0

type Option func(*translatorConfig) error

Option is a translator creation option.

func WithCountSumMetrics added in v0.37.0

func WithCountSumMetrics() Option

WithCountSumMetrics exports .count and .sum histogram metrics.

func WithDeltaTTL added in v0.37.0

func WithDeltaTTL(deltaTTL int64) Option

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

func WithFallbackHostnameProvider added in v0.37.0

func WithFallbackHostnameProvider(provider HostnameProvider) Option

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

func WithHistogramMode added in v0.37.0

func WithHistogramMode(mode HistogramMode) Option

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

func WithInstrumentationLibraryMetadataAsTags added in v0.37.0

func WithInstrumentationLibraryMetadataAsTags() Option

WithInstrumentationLibraryMetadataAsTags sets instrumentation library metadata as tags.

func WithNumberMode added in v0.37.0

func WithNumberMode(mode NumberMode) Option

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

func WithQuantiles added in v0.37.0

func WithQuantiles() Option

WithQuantiles enables quantiles exporting for summary metrics.

func WithResourceAttributesAsTags added in v0.37.0

func WithResourceAttributesAsTags() Option

WithResourceAttributesAsTags sets resource attributes as tags.

type SketchConsumer added in v0.38.0

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 TagsConsumer added in v0.42.0

type TagsConsumer interface {
	// ConsumeTag consumes a tag
	ConsumeTag(tag string)
}

TagsConsumer is a tags consumer. It is an optional interface that can be implemented by a Consumer. Consumed tags are used for running metrics, and should represent some resource running a Collector (e.g. Fargate task).

type TimeSeriesConsumer added in v0.38.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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