datadogexporter

package module
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 41 Imported by: 10

README

Datadog Exporter

Status
Stability traces beta
metrics beta
logs alpha
Supported pipeline types traces, metrics, logs
Distributions contrib, AWS

Please review the Collector's security documentation, which contains recommendations on securing sensitive information such as the API key required by this exporter.

Visit the official documentation for usage instructions.

FAQs

Why am I getting errors 413 - Request Entity Too Large, how do I fix it?

This error indicates the payload size sent by the Datadog exporter exceeds the size limit (see previous examples https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16834, https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/17566).

This is usually caused by the pipeline batching too many telemetry data before sending to the Datadog exporter. To fix that, try lowering send_batch_size and send_batch_max_size in your batchprocessor config. You might want to have a separate batch processor dedicated for datadog exporter if other exporters expect a larger batch size, e.g.

processors:
  batch:  # To be used by other exporters
    timeout: 1s
    # Default value for send_batch_size is 8192
  batch/datadog:
    send_batch_max_size: 100
    send_batch_size: 10
    timeout: 10s
...
service:
  pipelines:
    metrics:
      receivers: ...
      processors: [batch/datadog]
      exporters: [datadog]

The exact values for send_batch_size and send_batch_max_size depends on your specific workload. Also note that, Datadog intake has different payload size limits for the 3 signal types:

Documentation

Index

Constants

View Source
const (
	// DefaultSite is the default site of the Datadog intake to send data to
	DefaultSite = "datadoghq.com"
)

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() exporter.Factory

NewFactory creates a Datadog exporter factory

Types

type APIConfig

type APIConfig struct {
	// Key is the Datadog API key to associate your Agent's data with your organization.
	// Create a new API key here: https://app.datadoghq.com/account/settings
	Key configopaque.String `mapstructure:"key"`

	// Site is the site of the Datadog intake to send data to.
	// The default value is "datadoghq.com".
	Site string `mapstructure:"site"`

	// FailOnInvalidKey states whether to exit at startup on invalid API key.
	// The default value is false.
	FailOnInvalidKey bool `mapstructure:"fail_on_invalid_key"`
}

APIConfig defines the API configuration options

type Config

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

	LimitedHTTPClientSettings `mapstructure:",squash"`

	TagsConfig `mapstructure:",squash"`

	// API defines the Datadog API configuration.
	API APIConfig `mapstructure:"api"`

	// Metrics defines the Metrics exporter specific configuration
	Metrics MetricsConfig `mapstructure:"metrics"`

	// Traces defines the Traces exporter specific configuration
	Traces TracesConfig `mapstructure:"traces"`

	// Logs defines the Logs exporter specific configuration
	Logs LogsConfig `mapstructure:"logs"`

	// HostMetadata defines the host metadata specific configuration
	HostMetadata HostMetadataConfig `mapstructure:"host_metadata"`

	// OnlyMetadata defines whether to only send metadata
	// This is useful for agent-collector setups, so that
	// metadata about a host is sent to the backend even
	// when telemetry data is reported via a different host.
	//
	// This flag is incompatible with disabling host metadata,
	// `use_resource_metadata`, or `host_metadata::hostname_source != first_resource`
	OnlyMetadata bool `mapstructure:"only_metadata"`
}

Config defines configuration for the Datadog exporter.

func (*Config) Unmarshal added in v0.55.0

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

Unmarshal a configuration map into the configuration struct.

func (*Config) Validate added in v0.55.0

func (c *Config) Validate() error

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

type CumulativeMonotonicSumMode added in v0.55.0

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

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

type HistogramConfig added in v0.55.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 and .count metrics for histograms.
	// The current default is false.
	SendCountSum bool `mapstructure:"send_count_sum_metrics"`
}

HistogramConfig customizes export of OTLP Histograms.

type HistogramMode added in v0.55.0

type HistogramMode string
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

type HostMetadataConfig added in v0.55.0

type HostMetadataConfig struct {
	// Enabled enables the host metadata functionality.
	Enabled bool `mapstructure:"enabled"`

	// HostnameSource is the source for the hostname of host metadata.
	// Valid values are 'first_resource' and 'config_or_system':
	// - 'first_resource' picks the host metadata hostname from the resource
	//    attributes on the first OTLP payload that gets to the exporter.
	//    If the first payload lacks hostname-like attributes, it will fallback to 'config_or_system'.
	//    Do not use this hostname source if receiving data from multiple hosts.
	// - 'config_or_system' picks the host metadata hostname from the 'hostname' setting,
	//    If this is empty it will use available system APIs and cloud provider endpoints.
	//
	// The default is 'config_or_system'.
	HostnameSource HostnameSource `mapstructure:"hostname_source"`

	// Tags is a list of host tags.
	// These tags will be attached to telemetry signals that have the host metadata hostname.
	// To attach tags to telemetry signals regardless of the host, use a processor instead.
	Tags []string `mapstructure:"tags"`
}

HostMetadataConfig defines the host metadata related configuration. Host metadata is the information used for populating the infrastructure list, the host map and providing host tags functionality.

The exporter will send host metadata for a single host, whose name is chosen according to `host_metadata::hostname_source`.

type HostnameSource added in v0.55.0

type HostnameSource string

HostnameSource is the source for the hostname of host metadata.

const (
	// HostnameSourceFirstResource picks the host metadata hostname from the resource
	// attributes on the first OTLP payload that gets to the exporter. If it is lacking any
	// hostname-like attributes, it will fallback to 'config_or_system' behavior (see below).
	//
	// Do not use this hostname source if receiving data from multiple hosts.
	HostnameSourceFirstResource HostnameSource = "first_resource"

	// HostnameSourceConfigOrSystem picks the host metadata hostname from the 'hostname' setting,
	// and if this is empty, from available system APIs and cloud provider endpoints.
	HostnameSourceConfigOrSystem HostnameSource = "config_or_system"
)

func (*HostnameSource) UnmarshalText added in v0.55.0

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

type LimitedHTTPClientSettings added in v0.55.0

type LimitedHTTPClientSettings struct {
	TLSSetting LimitedTLSClientSettings `mapstructure:"tls,omitempty"`
}

type LimitedTLSClientSettings added in v0.55.0

type LimitedTLSClientSettings struct {
	// InsecureSkipVerify controls whether a client verifies the server's
	// certificate chain and host name.
	InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
}

LimitedTLSClientSetting is a subset of TLSClientSetting, see LimitedHTTPClientSettings for more details

type LogsConfig added in v0.61.0

type LogsConfig struct {
	// TCPAddr.Endpoint is the host of the Datadog intake server to send logs to.
	// If unset, the value is obtained from the Site.
	confignet.TCPAddr `mapstructure:",squash"`

	// DumpPayloads report whether payloads should be dumped when logging level is debug.
	DumpPayloads bool `mapstructure:"dump_payloads"`
}

LogsConfig defines logs exporter specific configuration

type MetricsConfig

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

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

	ExporterConfig MetricsExporterConfig `mapstructure:",squash"`

	// 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"`
}

MetricsConfig defines the metrics exporter specific configuration options

type MetricsExporterConfig added in v0.55.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"`

	// 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 SumConfig added in v0.55.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"`
}

SumConfig customizes export of OTLP Sums.

type SummaryConfig added in v0.55.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 added in v0.55.0

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

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

type TagsConfig

type TagsConfig struct {
	// Hostname is the host name for unified service tagging.
	// If unset, it is determined automatically.
	Hostname string `mapstructure:"hostname"`
}

TagsConfig defines the tag-related configuration It is embedded in the configuration

type TracesConfig

type TracesConfig struct {
	// TCPAddr.Endpoint is the host of the Datadog intake server to send traces to.
	// If unset, the value is obtained from the Site.
	confignet.TCPAddr `mapstructure:",squash"`

	// ignored resources
	// A blacklist of regular expressions can be provided to disable certain traces based on their resource name
	// all entries must be surrounded by double quotes and separated by commas.
	// ignore_resources: ["(GET|POST) /healthcheck"]
	IgnoreResources []string `mapstructure:"ignore_resources"`

	// SpanNameRemappings is the map of datadog span names and preferred name to map to. This can be used to
	// automatically map Datadog Span Operation Names to an updated value. All entries should be key/value pairs.
	// span_name_remappings:
	//   io.opentelemetry.javaagent.spring.client: spring.client
	//   instrumentation:express.server: express
	//   go.opentelemetry.io_contrib_instrumentation_net_http_otelhttp.client: http.client
	SpanNameRemappings map[string]string `mapstructure:"span_name_remappings"`

	// If set to true the OpenTelemetry span name will used in the Datadog resource name.
	// If set to false the resource name will be filled with the instrumentation library name + span kind.
	// The default value is `false`.
	SpanNameAsResourceName bool `mapstructure:"span_name_as_resource_name"`
	// contains filtered or unexported fields
}

TracesConfig defines the traces exporter specific configuration options

Directories

Path Synopsis
internal
clientutil
Package clientutil contains the Datadog API client util functions.
Package clientutil contains the Datadog API client util functions.
logs
Package logs provides utils for transforming OTLP LogRecord to Datadog format it also provides sender for submitting transformed logs to datadog backend This uses datadog-api-client-go for submitting logs
Package logs provides utils for transforming OTLP LogRecord to Datadog format it also provides sender for submitting transformed logs to datadog backend This uses datadog-api-client-go for submitting logs
metadata
Package metadata is responsible for collecting host metadata from different providers such as EC2, ECS, AWS, etc and pushing it to Datadog.
Package metadata is responsible for collecting host metadata from different providers such as EC2, ECS, AWS, etc and pushing it to Datadog.
metadata/internal/azure
Package azure contains the Azure hostname provider
Package azure contains the Azure hostname provider
metadata/internal/ec2
Package ec2 contains the AWS EC2 hostname provider
Package ec2 contains the AWS EC2 hostname provider
metadata/internal/ecs
Package ecs contains the ECS Fargate hostname provider
Package ecs contains the ECS Fargate hostname provider
metadata/internal/gcp
Package gcp contains the GCP hostname provider
Package gcp contains the GCP hostname provider
metadata/internal/gohai
package gohai provides system information like cpu, memory in a format that is expected by the datadog intake
package gohai provides system information like cpu, memory in a format that is expected by the datadog intake
metadata/internal/k8s
Package k8s contains the Kubernetes hostname provider
Package k8s contains the Kubernetes hostname provider
metadata/internal/system
Package system contains the system hostname provider
Package system contains the system hostname provider
metadata/provider
Package provider contains the cluster name provider
Package provider contains the cluster name provider
metadata/valid
Package valid contains functions that validate hostnames
Package valid contains functions that validate hostnames
metrics
Package metrics contains helper functions for Datadog metric export
Package metrics contains helper functions for Datadog metric export
metrics/sketches
Package sketches is a copy of part from github.com/DataDog/datadog-agent/pkg/metrics.
Package sketches is a copy of part from github.com/DataDog/datadog-agent/pkg/metrics.
scrub
Package scrub contains a Scrubber that scrubs error from sensitive details
Package scrub contains a Scrubber that scrubs error from sensitive details
testutil
Package testutil contains the test util functions
Package testutil contains the test util functions

Jump to

Keyboard shortcuts

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