config

package
v0.36.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 11

Documentation

Index

Constants

View Source
const TelemetryEndpointPrefix = "https://instrumentation-telemetry-intake."

TelemetryEndpointPrefix specifies the prefix of the telemetry endpoint URL.

Variables

View Source
var ErrMissingAPIKey = errors.New("you must specify an API Key, either via a configuration file or the DD_API_KEY env var")

ErrMissingAPIKey is returned when the config could not be validated due to missing API key.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	Enabled      bool
	AgentVersion string
	Site         string // the intake site to use (e.g. "datadoghq.com")

	// FargateOrchestrator specifies the name of the Fargate orchestrator. e.g. "ECS", "EKS", "Unknown"
	FargateOrchestrator FargateOrchestratorName

	// Global
	Hostname   string
	DefaultEnv string // the traces will default to this environment
	ConfigPath string // the source of this config, if any

	// Endpoints specifies the set of hosts and API keys where traces and stats
	// will be uploaded to. The first endpoint is the main configuration endpoint;
	// any following ones are read from the 'additional_endpoints' parts of the
	// configuration file, if present.
	Endpoints []*Endpoint

	// Concentrator
	BucketInterval   time.Duration // the size of our pre-aggregation per bucket
	ExtraAggregators []string

	// Sampler configuration
	ExtraSampleRate    float64
	TargetTPS          float64
	ErrorTPS           float64
	DisableRareSampler bool
	MaxEPS             float64
	MaxRemoteTPS       float64

	// Receiver
	ReceiverHost    string
	ReceiverPort    int
	ReceiverSocket  string // if not empty, UDS will be enabled on unix://<receiver_socket>
	ConnectionLimit int    // for rate-limiting, how many unique connections to allow in a lease period (30s)
	ReceiverTimeout int
	MaxRequestBytes int64 // specifies the maximum allowed request size for incoming trace payloads

	WindowsPipeName        string
	PipeBufferSize         int
	PipeSecurityDescriptor string

	GUIPort string // the port of the Datadog Agent GUI (for control access)

	// Writers
	SynchronousFlushing     bool // Mode where traces are only submitted when FlushAsync is called, used for Serverless Extension
	StatsWriter             *WriterConfig
	TraceWriter             *WriterConfig
	ConnectionResetInterval time.Duration // frequency at which outgoing connections are reset. 0 means no reset is performed

	// internal telemetry
	StatsdHost     string
	StatsdPort     int
	StatsdPipeName string // for Windows Pipes
	StatsdSocket   string // for UDS Sockets

	// logging
	LogLevel      string
	LogFilePath   string
	LogThrottling bool

	// watchdog
	MaxMemory        float64       // MaxMemory is the threshold (bytes allocated) above which program panics and exits, to be restarted
	MaxCPU           float64       // MaxCPU is the max UserAvg CPU the program should consume
	WatchdogInterval time.Duration // WatchdogInterval is the delay between 2 watchdog checks

	// http/s proxying
	ProxyURL          *url.URL
	SkipSSLValidation bool

	// filtering
	Ignore map[string][]string

	// ReplaceTags is used to filter out sensitive information from tag values.
	// It maps tag keys to a set of replacements. Only supported in A6.
	ReplaceTags []*ReplaceRule

	// GlobalTags list metadata that will be added to all spans
	GlobalTags map[string]string

	// transaction analytics
	AnalyzedRateByServiceLegacy map[string]float64
	AnalyzedSpansByService      map[string]map[string]float64

	// infrastructure agent binary
	DDAgentBin string

	// Obfuscation holds sensitive data obufscator's configuration.
	Obfuscation *ObfuscationConfig

	// RequireTags specifies a list of tags which must be present on the root span in order for a trace to be accepted.
	RequireTags []*Tag

	// RejectTags specifies a list of tags which must be absent on the root span in order for a trace to be accepted.
	RejectTags []*Tag

	// OTLPReceiver holds the configuration for OpenTelemetry receiver.
	OTLPReceiver *OTLP

	// ProfilingProxy specifies settings for the profiling proxy.
	ProfilingProxy ProfilingProxyConfig

	// Telemetry settings
	TelemetryConfig *TelemetryConfig

	// AppSec contains AppSec configuration.
	AppSec AppSecConfig

	// DebuggerProxy contains the settings for the Live Debugger proxy.
	DebuggerProxy DebuggerProxyConfig

	// Proxy specifies a function to return a proxy for a given Request.
	// See (net/http.Transport).Proxy for more details.
	Proxy func(*http.Request) (*url.URL, error) `json:"-"`

	// MaxCatalogEntries specifies the maximum number of services to be added to the priority sampler's
	// catalog. If not set (0) it will default to 5000.
	MaxCatalogEntries int

	// RemoteSamplingClient ...
	RemoteSamplingClient RemoteClient

	// ContainerTags ...
	ContainerTags func(cid string) ([]string, error) `json:"-"`
}

AgentConfig handles the interpretation of the configuration (with default behaviors) in one place. It is also a simple structure to share across all the Agent components, with 100% safe and reliable values. It is exposed with expvar, so make sure to exclude any sensible field from JSON encoding. Use New() to create an instance.

func New

func New() *AgentConfig

New returns a configuration with the default values.

func (*AgentConfig) APIKey

func (c *AgentConfig) APIKey() string

APIKey returns the first (main) endpoint's API key.

func (*AgentConfig) NewHTTPClient

func (c *AgentConfig) NewHTTPClient() *ResetClient

NewHTTPClient returns a new http.Client to be used for outgoing connections to the Datadog API.

func (*AgentConfig) NewHTTPTransport

func (c *AgentConfig) NewHTTPTransport() *http.Transport

NewHTTPTransport returns a new http.Transport to be used for outgoing connections to the Datadog API.

type AppSecConfig

type AppSecConfig struct {
	// Enabled reports whether AppSec is enabled.
	Enabled bool
	// MaxPayloadSize ...
	MaxPayloadSize int64
	// APIKey ...
	APIKey string
	// DDURL ...
	DDURL string
}

AppSecConfig ...

type CreditCardsConfig

type CreditCardsConfig struct {
	// Enabled specifies whether this feature should be enabled.
	Enabled bool `mapstructure:"enabled"`

	// Luhn specifies whether Luhn checksum validation should be enabled.
	// https://dev.to/shiraazm/goluhn-a-simple-library-for-generating-calculating-and-verifying-luhn-numbers-588j
	// It reduces false positives, but increases the CPU time X3.
	Luhn bool `mapstructure:"luhn"`
}

CreditCardsConfig holds the configuration for credit card obfuscation in (Meta) tags.

type DebuggerProxyConfig

type DebuggerProxyConfig struct {
	// DDURL ...
	DDURL string
	// APIKey ...
	APIKey string
}

DebuggerProxyConfig ...

type Enablable

type Enablable struct {
	Enabled bool `mapstructure:"enabled"`
}

Enablable can represent any option that has an "enabled" boolean sub-field.

type Endpoint

type Endpoint struct {
	APIKey string `json:"-"` // never marshal this
	Host   string

	// NoProxy will be set to true when the proxy setting for the trace API endpoint
	// needs to be ignored (e.g. it is part of the "no_proxy" list in the yaml settings).
	NoProxy bool
}

Endpoint specifies an endpoint that the trace agent will write data (traces, stats & services) to.

type FargateOrchestratorName

type FargateOrchestratorName string

FargateOrchestratorName is a Fargate orchestrator name.

const (
	// OrchestratorECS represents AWS ECS
	OrchestratorECS FargateOrchestratorName = "ECS"
	// OrchestratorEKS represents AWS EKS
	OrchestratorEKS FargateOrchestratorName = "EKS"
	// OrchestratorUnknown is used when we cannot retrieve the orchestrator
	OrchestratorUnknown FargateOrchestratorName = "Unknown"
)

type HTTPObfuscationConfig

type HTTPObfuscationConfig struct {
	// RemoveQueryStrings determines query strings to be removed from HTTP URLs.
	RemoveQueryString bool `mapstructure:"remove_query_string" json:"remove_query_string"`

	// RemovePathDigits determines digits in path segments to be obfuscated.
	RemovePathDigits bool `mapstructure:"remove_paths_with_digits" json:"remove_path_digits"`
}

HTTPObfuscationConfig holds the configuration settings for HTTP obfuscation.

type JSONObfuscationConfig

type JSONObfuscationConfig struct {
	// Enabled will specify whether obfuscation should be enabled.
	Enabled bool `mapstructure:"enabled"`

	// KeepValues will specify a set of keys for which their values will
	// not be obfuscated.
	KeepValues []string `mapstructure:"keep_values"`

	// ObfuscateSQLValues will specify a set of keys for which their values
	// will be passed through SQL obfuscation
	ObfuscateSQLValues []string `mapstructure:"obfuscate_sql_values"`
}

JSONObfuscationConfig holds the obfuscation configuration for sensitive data found in JSON objects.

type OTLP

type OTLP struct {
	// BindHost specifies the host to bind the receiver to.
	BindHost string `mapstructure:"-"`

	// HTTPPort specifies the port to use for the plain HTTP receiver.
	// If unset (or 0), the receiver will be off.
	HTTPPort int `mapstructure:"http_port"`

	// GRPCPort specifies the port to use for the plain HTTP receiver.
	// If unset (or 0), the receiver will be off.
	GRPCPort int `mapstructure:"grpc_port"`

	// MaxRequestBytes specifies the maximum number of bytes that will be read
	// from an incoming HTTP request.
	MaxRequestBytes int64 `mapstructure:"-"`
}

OTLP holds the configuration for the OpenTelemetry receiver.

type ObfuscationConfig

type ObfuscationConfig struct {
	// ES holds the obfuscation configuration for ElasticSearch bodies.
	ES JSONObfuscationConfig `mapstructure:"elasticsearch"`

	// Mongo holds the obfuscation configuration for MongoDB queries.
	Mongo JSONObfuscationConfig `mapstructure:"mongodb"`

	// SQLExecPlan holds the obfuscation configuration for SQL Exec Plans. This is strictly for safety related obfuscation,
	// not normalization. Normalization of exec plans is configured in SQLExecPlanNormalize.
	SQLExecPlan JSONObfuscationConfig `mapstructure:"sql_exec_plan"`

	// SQLExecPlanNormalize holds the normalization configuration for SQL Exec Plans.
	SQLExecPlanNormalize JSONObfuscationConfig `mapstructure:"sql_exec_plan_normalize"`

	// HTTP holds the obfuscation settings for HTTP URLs.
	HTTP HTTPObfuscationConfig `mapstructure:"http"`

	// RemoveStackTraces specifies whether stack traces should be removed.
	// More specifically "error.stack" tag values will be cleared.
	RemoveStackTraces bool `mapstructure:"remove_stack_traces"`

	// Redis holds the configuration for obfuscating the "redis.raw_command" tag
	// for spans of type "redis".
	Redis Enablable `mapstructure:"redis"`

	// Memcached holds the configuration for obfuscating the "memcached.command" tag
	// for spans of type "memcached".
	Memcached Enablable `mapstructure:"memcached"`

	// CreditCards holds the configuration for obfuscating credit cards.
	CreditCards CreditCardsConfig `mapstructure:"credit_cards"`
}

ObfuscationConfig holds the configuration for obfuscating sensitive data for various span types.

func (*ObfuscationConfig) Export

func (o *ObfuscationConfig) Export() obfuscate.Config

Export returns an obfuscate.Config matching o.

type ProfilingProxyConfig

type ProfilingProxyConfig struct {
	// DDURL ...
	DDURL string
	// AdditionalEndpoints ...
	AdditionalEndpoints map[string][]string
}

ProfilingProxyConfig ...

type RemoteClient

type RemoteClient interface {
	SamplingUpdates() <-chan SamplingUpdate
	Close()
}

RemoteClient client is used to APM Sampling Updates from a remote source. Within the Datadog Agent the implementation is (cmd/trace-agent.remoteClient).

type ReplaceRule

type ReplaceRule struct {
	// Name specifies the name of the tag that the replace rule addresses. However,
	// some exceptions apply such as:
	// • "resource.name" will target the resource
	// • "*" will target all tags and the resource
	Name string `mapstructure:"name"`

	// Pattern specifies the regexp pattern to be used when replacing. It must compile.
	Pattern string `mapstructure:"pattern"`

	// Re holds the compiled Pattern and is only used internally.
	Re *regexp.Regexp `mapstructure:"-"`

	// Repl specifies the replacement string to be used when Pattern matches.
	Repl string `mapstructure:"repl"`
}

ReplaceRule specifies a replace rule.

type ResetClient

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

ResetClient wraps (http.Client).Do and resets the underlying connections at the configured interval

func NewResetClient

func NewResetClient(resetInterval time.Duration, httpClientFactory func() *http.Client) *ResetClient

NewResetClient returns an initialized Client resetting connections at the passed resetInterval ("0" means that no reset is performed). The underlying http.Client used will be created using the passed http client factory.

func (*ResetClient) Do

func (c *ResetClient) Do(req *http.Request) (*http.Response, error)

Do wraps (http.Client).Do. Thread safe.

type SamplingUpdate

type SamplingUpdate struct {
	Configs map[string]client.ConfigAPMSamling
}

SamplingUpdate ...

type Tag

type Tag struct {
	K, V string
}

Tag represents a key/value pair.

type TelemetryConfig

type TelemetryConfig struct {
	Enabled   bool `mapstructure:"enabled"`
	Endpoints []*Endpoint
}

TelemetryConfig holds Instrumentation telemetry Endpoints information

type WriterConfig

type WriterConfig struct {
	// ConnectionLimit specifies the maximum number of concurrent outgoing
	// connections allowed for the sender.
	ConnectionLimit int `mapstructure:"connection_limit"`

	// QueueSize specifies the maximum number or payloads allowed to be queued
	// in the sender.
	QueueSize int `mapstructure:"queue_size"`

	// FlushPeriodSeconds specifies the frequency at which the writer's buffer
	// will be flushed to the sender, in seconds. Fractions are permitted.
	FlushPeriodSeconds float64 `mapstructure:"flush_period_seconds"`
}

WriterConfig specifies configuration for an API writer.

Directories

Path Synopsis
configdefs module
Package features provides an API for enabling features and checking if a given feature is enabled.
Package features provides an API for enabling features and checking if a given feature is enabled.

Jump to

Keyboard shortcuts

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