serializerexporter

package module
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Overview

Package serializerexporter contains the impleemntation of an exporter which is able to serialize OTLP Metrics to an agent demultiplexer.

Index

Constants

View Source
const (
	// TypeStr defines the serializer exporter type string.
	TypeStr = "serializer"
)

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(s serializer.MetricSerializer, enricher tagenricher, hostGetter func(context.Context) (string, error), statsIn chan []byte, wg *sync.WaitGroup) exp.Factory

NewFactory creates a new serializer exporter factory.

Types

type CumulativeMonotonicSumMode

type CumulativeMonotonicSumMode string

CumulativeMonotonicSumMode is the export mode for OTLP Sum metrics.

const (
	// CumulativeMonotonicSumModeToDelta calculates delta for
	// cumulative monotonic sum metrics in the client side and reports
	// them as Datadog counts.
	CumulativeMonotonicSumModeToDelta CumulativeMonotonicSumMode = "to_delta"

	// CumulativeMonotonicSumModeRawValue reports the raw value for
	// cumulative monotonic sum metrics as a Datadog gauge.
	CumulativeMonotonicSumModeRawValue CumulativeMonotonicSumMode = "raw_value"
)

func (*CumulativeMonotonicSumMode) UnmarshalText

func (sm *CumulativeMonotonicSumMode) UnmarshalText(in []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Exporter added in v0.53.0

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

Exporter translate OTLP metrics into the Datadog format and sends them to the agent serializer.

func NewExporter added in v0.53.0

func NewExporter(
	set component.TelemetrySettings,
	attributesTranslator *attributes.Translator,
	s serializer.MetricSerializer,
	cfg *ExporterConfig,
	enricher tagenricher,
	hostGetter SourceProviderFunc,
	statsIn chan []byte,
) (*Exporter, error)

NewExporter creates a new exporter that translates OTLP metrics into the Datadog format and sends

func (*Exporter) ConsumeMetrics added in v0.53.0

func (e *Exporter) ConsumeMetrics(ctx context.Context, ld pmetric.Metrics) error

ConsumeMetrics translates OTLP metrics into the Datadog format and sends

type ExporterConfig added in v0.53.0

type ExporterConfig struct {
	// squash ensures fields are correctly decoded in embedded struct
	exporterhelper.TimeoutSettings `mapstructure:",squash"`
	exporterhelper.QueueSettings   `mapstructure:",squash"`

	Metrics MetricsConfig `mapstructure:"metrics"`
	// contains filtered or unexported fields
}

ExporterConfig defines configuration for the serializer exporter.

func (*ExporterConfig) Unmarshal added in v0.53.0

func (e *ExporterConfig) Unmarshal(configMap *confmap.Conf) error

Unmarshal a configuration map into the configuration struct.

func (*ExporterConfig) Validate added in v0.53.0

func (e *ExporterConfig) Validate() error

Validate configuration

type HistogramConfig added in v0.53.0

type HistogramConfig struct {
	// Mode for exporting histograms. Valid values are 'distributions', 'counters' or 'nobuckets'.
	//  - 'distributions' sends histograms as Datadog distributions (recommended).
	//  - 'counters' sends histograms as Datadog counts, one metric per bucket.
	//  - 'nobuckets' sends no bucket histogram metrics. .sum and .count metrics will still be sent
	//    if `send_count_sum_metrics` is enabled.
	//
	// The current default is 'distributions'.
	Mode HistogramMode `mapstructure:"mode"`

	// SendCountSum states if the export should send .sum, .count, .min and .max metrics for histograms.
	// The default is false.
	// Deprecated: use `send_aggregation_metrics` instead.
	SendCountSum bool `mapstructure:"send_count_sum_metrics"`

	// SendAggregations states if the export should send .sum, .count, .min and .max metrics for histograms.
	// The default is false.
	SendAggregations bool `mapstructure:"send_aggregation_metrics"`
}

HistogramConfig customizes export of OTLP Histograms.

func (*HistogramConfig) Validate added in v0.55.0

func (c *HistogramConfig) Validate() error

Validate HistogramConfig

type HistogramMode added in v0.55.0

type HistogramMode string

HistogramMode is the export mode for OTLP Histogram metrics.

const (
	// HistogramModeNoBuckets reports no bucket histogram metrics. .sum and .count metrics will still be sent
	// if `send_count_sum_metrics` is enabled.
	HistogramModeNoBuckets HistogramMode = "nobuckets"
	// HistogramModeCounters reports histograms as Datadog counts, one metric per bucket.
	HistogramModeCounters HistogramMode = "counters"
	// HistogramModeDistributions reports histograms as Datadog distributions (recommended).
	HistogramModeDistributions HistogramMode = "distributions"
)

func (*HistogramMode) UnmarshalText added in v0.55.0

func (hm *HistogramMode) UnmarshalText(in []byte) error

UnmarshalText unmarshals bytes to HistogramMode

type InitialValueMode

type InitialValueMode string

InitialValueMode defines what the exporter should do with the initial value of a time series when transforming from cumulative to delta.

const (
	// InitialValueModeAuto reports the initial value if its start timestamp
	// is set and it happens after the process was started.
	InitialValueModeAuto InitialValueMode = "auto"

	// InitialValueModeDrop always drops the initial value.
	InitialValueModeDrop InitialValueMode = "drop"

	// InitialValueModeKeep always reports the initial value.
	InitialValueModeKeep InitialValueMode = "keep"
)

func (*InitialValueMode) UnmarshalText

func (iv *InitialValueMode) UnmarshalText(in []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type MetricsConfig added in v0.53.0

type MetricsConfig struct {
	// Enabled reports whether Metrics should be enabled.
	Enabled bool `mapstructure:"enabled"`

	// TCPAddr.Endpoint is the host of the Datadog intake server to send metrics to.
	// If unset, the value is obtained from the Site.
	confignet.TCPAddrConfig `mapstructure:",squash"`

	// DeltaTTL defines the time that previous points of a cumulative monotonic
	// metric are kept in memory to calculate deltas
	DeltaTTL int64 `mapstructure:"delta_ttl"`

	ExporterConfig MetricsExporterConfig `mapstructure:",squash"`

	// TagCardinality is the level of granularity of tags to send for OTLP metrics.
	TagCardinality string `mapstructure:"tag_cardinality"`

	// HistConfig defines the export of OTLP Histograms.
	HistConfig HistogramConfig `mapstructure:"histograms"`

	// SumConfig defines the export of OTLP Sums.
	SumConfig SumConfig `mapstructure:"sums"`

	// SummaryConfig defines the export for OTLP Summaries.
	SummaryConfig SummaryConfig `mapstructure:"summaries"`

	// APMStatsReceiverAddr is the address to send APM stats to.
	APMStatsReceiverAddr string `mapstructure:"apm_stats_receiver_addr"`

	// Tags is a comma-separated list of tags to add to all metrics.
	Tags string `mapstructure:"tags"`
}

MetricsConfig defines the metrics exporter specific configuration options

type MetricsExporterConfig added in v0.53.0

type MetricsExporterConfig struct {
	// ResourceAttributesAsTags, if set to true, will use the exporterhelper feature to transform all
	// resource attributes into metric labels, which are then converted into tags
	ResourceAttributesAsTags bool `mapstructure:"resource_attributes_as_tags"`

	// Deprecated: Use InstrumentationScopeMetadataAsTags favor of in favor of
	// https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.15.0
	// Both must not be set at the same time.
	// InstrumentationLibraryMetadataAsTags, if set to true, adds the name and version of the
	// instrumentation library that created a metric to the metric tags
	InstrumentationLibraryMetadataAsTags bool `mapstructure:"instrumentation_library_metadata_as_tags"`

	// InstrumentationScopeMetadataAsTags, if set to true, adds the name and version of the
	// instrumentation scope that created a metric to the metric tags
	InstrumentationScopeMetadataAsTags bool `mapstructure:"instrumentation_scope_metadata_as_tags"`
}

MetricsExporterConfig provides options for a user to customize the behavior of the metrics exporter

type SourceProviderFunc added in v0.56.0

type SourceProviderFunc func(context.Context) (string, error)

SourceProviderFunc is an adapter to allow the use of a function as a metrics.HostnameProvider.

func (SourceProviderFunc) Source added in v0.56.0

Source calls f and wraps in a source struct.

type SumConfig added in v0.53.0

type SumConfig struct {
	// CumulativeMonotonicMode is the mode for exporting OTLP Cumulative Monotonic Sums.
	// Valid values are 'to_delta' or 'raw_value'.
	//  - 'to_delta' calculates delta for cumulative monotonic sums and sends it as a Datadog count.
	//  - 'raw_value' sends the raw value of cumulative monotonic sums as Datadog gauges.
	//
	// The default is 'to_delta'.
	// See https://docs.datadoghq.com/metrics/otlp/?tab=sum#mapping for details and examples.
	CumulativeMonotonicMode CumulativeMonotonicSumMode `mapstructure:"cumulative_monotonic_mode"`

	// InitialCumulativeMonotonicMode defines the behavior of the exporter when receiving the first value
	// of a cumulative monotonic sum.
	InitialCumulativeMonotonicMode InitialValueMode `mapstructure:"initial_cumulative_monotonic_value"`
}

SumConfig customizes export of OTLP Sums.

type SummaryConfig added in v0.53.0

type SummaryConfig struct {
	// Mode is the the mode for exporting OTLP Summaries.
	// Valid values are 'noquantiles' or 'gauges'.
	//  - 'noquantiles' sends no `.quantile` metrics. `.sum` and `.count` metrics will still be sent.
	//  - 'gauges' sends `.quantile` metrics as gauges tagged by the quantile.
	//
	// The default is 'gauges'.
	// See https://docs.datadoghq.com/metrics/otlp/?tab=summary#mapping for details and examples.
	Mode SummaryMode `mapstructure:"mode"`
}

SummaryConfig customizes export of OTLP Summaries.

type SummaryMode

type SummaryMode string

SummaryMode is the export mode for OTLP Summary metrics.

const (
	// SummaryModeNoQuantiles sends no `.quantile` metrics. `.sum` and `.count` metrics will still be sent.
	SummaryModeNoQuantiles SummaryMode = "noquantiles"
	// SummaryModeGauges sends `.quantile` metrics as gauges tagged by the quantile.
	SummaryModeGauges SummaryMode = "gauges"
)

func (*SummaryMode) UnmarshalText

func (sm *SummaryMode) UnmarshalText(in []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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