serializerexporter

package module
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 58 Imported by: 2

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

View Source
var (
	OTLPIngestAgentMetricsEvents   coretelemetry.Counter
	OTLPIngestAgentMetricsRequests coretelemetry.Counter
	OTLPIngestDDOTMetricsEvents    coretelemetry.Counter
	OTLPIngestDDOTMetricsRequests  coretelemetry.Counter
)

These metrics are for measuring the current volume of traffic for OTLP Metric ingestion.

Functions

func InitSerializer added in v0.71.0

func InitSerializer(logger *zap.Logger, cfg *ExporterConfig, sourceProvider source.Provider) (*serializer.Serializer, *defaultforwarder.DefaultForwarder, error)

InitSerializer initializes the serializer and forwarder for sending metrics. Should only be used in OSS Datadog exporter or in tests.

func InitTelemetry added in v0.76.0

func InitTelemetry(tm coretelemetry.Component)

InitTelemetry wires the OTLP metrics ingestion counters with the provided telemetry component. Passing nil falls back to a noop component so callers can safely invoke the counters before initialization.

func NewFactory

func NewFactory() exp.Factory

NewFactory implements the required func to be used in OCB. This interface does not work with APM stats. Do not change the func signature or OCB will fail.

func NewFactoryForAgent added in v0.64.0

func NewFactoryForAgent(s serializer.MetricSerializer, hostGetter SourceProviderFunc, store TelemetryStore) exp.Factory

NewFactoryForAgent creates a new serializer exporter factory for Agent OTLP ingestion. Serializer exporter should never receive APM stats in Agent OTLP ingestion.

func NewFactoryForOSSExporter added in v0.66.0

func NewFactoryForOSSExporter(typ component.Type, statsIn chan []byte) exp.Factory

NewFactoryForOSSExporter creates a new serializer exporter factory for the OSS Datadog exporter.

func NewFactoryForOTelAgent added in v0.65.0

func NewFactoryForOTelAgent(
	s serializer.MetricSerializer,
	hostGetter SourceProviderFunc,
	statsIn chan []byte,
	gatewayusage otel.GatewayUsage,
	store TelemetryStore,
	reporter *inframetadata.Reporter,
) exp.Factory

NewFactoryForOTelAgent creates a new serializer exporter factory for the embedded collector.

Types

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(
	s serializer.MetricSerializer,
	cfg *ExporterConfig,
	hostGetter SourceProviderFunc,
	createConsumer createConsumerFunc,
	tr metrics.Provider,
	params exporter.Settings,
	reporter *inframetadata.Reporter,
	gatewayUsage otel.GatewayUsage,
	coatUsageMetric telemetry.Gauge,
	coatGWUsageMetric telemetry.Gauge,
	ipath ingestionPath,
) (*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.TimeoutConfig `mapstructure:",squash"`

	HTTPConfig confighttp.ClientConfig `mapstructure:",squash"`

	QueueBatchConfig configoptional.Optional[exporterhelper.QueueBatchConfig] `mapstructure:"sending_queue"`

	configtls.ClientConfig `mapstructure:"tls"`

	Metrics MetricsConfig `mapstructure:"metrics"`
	// API defines the Datadog API configuration.
	// It is useful for OSS OpenTelemetry Collector or to use
	// the serializer exporter with the OCB.
	API datadogconfig.APIConfig `mapstructure:"api"`

	// HostProvider is the function to get the host name.
	// OpenTelemetry Collector provides a override for this.
	HostProvider SourceProviderFunc `mapstructure:"-"`

	// ShutdownFunc is the function to call when the exporter is shutdown.
	// OpenTelemetry Collector provides additional shutdown logic.
	ShutdownFunc component.ShutdownFunc `mapstructure:"-"`

	// HostMetadataConfig defines the host metadata related configuration.
	HostMetadata datadogconfig.HostMetadataConfig `mapstructure:"host_metadata"`
	// contains filtered or unexported fields
}

ExporterConfig defines configuration for the serializer exporter.

func (*ExporterConfig) LogWarnings added in v0.66.0

func (c *ExporterConfig) LogWarnings(logger *zap.Logger)

LogWarnings logs warning messages that were generated on unmarshaling.

func (*ExporterConfig) Unmarshal added in v0.53.0

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

Unmarshal a configuration map into the configuration struct.

func (*ExporterConfig) Validate added in v0.53.0

func (c *ExporterConfig) Validate() error

Validate the configuration for errors. This is required by component.Config.

type HostMetadataPusher added in v0.71.0

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

HostMetadataPusher implements the inframetadata.Pusher interface

func NewPusher added in v0.71.0

NewPusher returns a new HostMetadataPusher

func (*HostMetadataPusher) Push added in v0.71.0

Push implements the Pusher.Push interface

type MetricsConfig added in v0.53.0

type MetricsConfig struct {
	Metrics datadogconfig.MetricsConfig `mapstructure:",squash"`

	// 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 SerializerConsumer added in v0.64.0

type SerializerConsumer interface {
	otlpmetrics.Consumer
	Send(s serializer.MetricSerializer) error
	// contains filtered or unexported methods
}

SerializerConsumer is a consumer that consumes OTLP metrics.

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

type TelemetryStore struct {
	// OTLPIngestMetrics tracks hosts running OTLP ingest on metrics
	OTLPIngestMetrics telemetry.Gauge
	// DDOTMetrics tracks hosts running DDOT and ingest metrics
	DDOTMetrics telemetry.Gauge
	// DDOTTraces tracks hosts running DDOT and ingest traces
	DDOTTraces telemetry.Gauge
	// DDOTGWUsage tracks hosts running DDOT in GW mode
	DDOTGWUsage telemetry.Gauge
}

TelemetryStore stores the internal COAT (cross-org agent telemetry) metrics in DDOT

Jump to

Keyboard shortcuts

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