datadogexporter

package module
v0.60.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package datadogexporter provides a factory for the Datadog exporter.

Index

Constants

View Source
const (
	// LogsStability is the stability level of the logs datatype.
	LogsStability = component.StabilityLevelBeta
	// TracesStability is the stability level of the traces datatype.
	TracesStability = component.StabilityLevelBeta
	// MetricsStability is the stability level of the metrics datatype.
	MetricsStability = component.StabilityLevelBeta
)
View Source
const (
	// DefaultSite is the default site of the Datadog intake to send data to
	DefaultSite = "datadoghq.com"
)

Variables

View Source
var Type = component.MustNewType("datadog")

Type is the type of the exporter

Functions

func CreateDefaultConfig added in v0.56.0

func CreateDefaultConfig() component.Config

CreateDefaultConfig creates the default exporter configuration

func Meter

func Meter(settings component.TelemetrySettings) metric.Meter

Meter returns a new metric.Meter for the exporter.

func NewFactory

NewFactory creates a Datadog exporter factory

func Tracer

func Tracer(settings component.TelemetrySettings) trace.Tracer

Tracer returns a new trace.Tracer for the exporter.

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 {
	confighttp.ClientConfig      `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
	exporterhelper.QueueSettings `mapstructure:"sending_queue"`
	configretry.BackOffConfig    `mapstructure:"retry_on_failure"`

	TagsConfig `mapstructure:",squash"`

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

	// Metrics defines the Metrics exporter specific configuration
	Metrics serializerexporter.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"`
	// contains filtered or unexported fields
}

Config defines configuration for the Datadog exporter.

func (*Config) Unmarshal

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

Unmarshal a configuration map into the configuration struct.

func (*Config) Validate

func (c *Config) Validate() error

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

type HostMetadataConfig

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

	// HostnameSource is the source for the hostname of host metadata.
	// This hostname is used for identifying the infrastructure list, host map and host tag information related to the host where the Datadog exporter is running.
	// Changing this setting will not change the host used to tag your metrics, traces and logs in any way.
	// For remote hosts, see https://docs.datadoghq.com/opentelemetry/schema_semantics/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

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

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

type LogsConfig

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.TCPAddrConfig `mapstructure:",squash"`

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

	// UseCompression enables the logs agent to compress logs before sending them.
	UseCompression bool `mapstructure:"use_compression"`

	// CompressionLevel accepts values from 0 (no compression) to 9 (maximum compression but higher resource usage).
	// Only takes effect if UseCompression is set to true.
	CompressionLevel int `mapstructure:"compression_level"`

	// BatchWait represents the maximum time the logs agent waits to fill each batch of logs before sending.
	BatchWait int `mapstructure:"batch_wait"`
}

LogsConfig defines logs exporter specific configuration

type TagsConfig

type TagsConfig struct {
	// Hostname is the fallback hostname used for payloads without hostname-identifying attributes.
	// This option will NOT change the hostname applied to your metrics, traces and logs if they already have hostname-identifying attributes.
	// If unset, the hostname will be determined automatically. See https://docs.datadoghq.com/opentelemetry/schema_semantics/hostname/?tab=datadogexporter#fallback-hostname-logic for details.
	//
	// Prefer using the `datadog.host.name` resource attribute over using this setting.
	// See https://docs.datadoghq.com/opentelemetry/schema_semantics/hostname/?tab=datadogexporter#general-hostname-semantic-conventions for details.
	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.TCPAddrConfig `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 `true`.
	SpanNameAsResourceName bool `mapstructure:"span_name_as_resource_name"`

	// If set to true, root spans and spans with a server or consumer `span.kind` will be marked as top-level.
	// Additionally, spans with a client or producer `span.kind` will have stats computed.
	// Enabling this config option may increase the number of spans that generate trace metrics, and may change which spans appear as top-level in Datadog.
	// ComputeTopLevelBySpanKind needs to be enabled in both the Datadog connector and Datadog exporter configs if both components are being used.
	// The default value is `true`.
	ComputeTopLevelBySpanKind bool `mapstructure:"compute_top_level_by_span_kind"`

	// TraceBuffer specifies the number of Datadog Agent TracerPayloads to buffer before dropping.
	// The default value is 0, meaning the Datadog Agent TracerPayloads are unbuffered.
	TraceBuffer int `mapstructure:"trace_buffer"`
}

TracesConfig defines the traces exporter specific configuration options

Jump to

Keyboard shortcuts

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