datadogexporter

package module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 25 Imported by: 10

README

Datadog Exporter

This exporter sends metric and trace data to Datadog.

Configuration

The only required setting is a Datadog API key.

datadog:
 api:
   key: "<API key>"

To send data to the Datadog EU site, set the api.site parameter to datadoghq.eu:

datadog:
 api:
   key: "<API key>"
   site: datadoghq.eu

The hostname, environment, service and version can be set in the configuration for unified service tagging.

See the sample configuration file under the example folder for other available options.

Trace Export Configuration

Note: Trace Export is not supported on windows at the moment

Documentation

Overview

Copyright The OpenTelemetry Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (

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

Variables

This section is empty.

Functions

func AggregateTracePayloadsByEnv

func AggregateTracePayloadsByEnv(tracePayloads []*pb.TracePayload) []*pb.TracePayload

func ComputeSublayerMetrics

func ComputeSublayerMetrics(t pb.Trace)

Compute Sublayers updates a spans metrics with relevant metadata so that it's duration and breakdown between different services can be accurately displayed in the Datadog UI

func ConvertToDatadogTd

func ConvertToDatadogTd(td pdata.Traces, cfg *Config, globalTags []string) ([]*pb.TracePayload, error)

converts Traces into an array of datadog trace payloads grouped by env

func GetAnalyzedSpans

func GetAnalyzedSpans(sps []*pb.Span) []*pb.Span

GetAnalyzedSpans finds all the analyzed spans in a trace, including top level spans and spans marked as analyzed by the tracer. A span is considered top-level if:

  • it's a root span
  • its parent is unknown (other part of the code, distributed trace)
  • its parent belongs to another service (in that case it's a "local root" being the highest ancestor of other spans belonging to this service and attached to it).

func GetHost

func GetHost(cfg *Config) *string

GetHost gets the hostname according to configuration. It gets the configuration hostname and if not available it relies on the OS hostname

func MapMetrics

func MapMetrics(logger *zap.Logger, cfg MetricsConfig, md pdata.Metrics) (series []datadog.Metric, droppedTimeSeries int)

MapMetrics maps OTLP metrics into the DataDog format

func NewFactory

func NewFactory() component.ExporterFactory

NewFactory creates a Datadog exporter factory

func ObfuscatePayload

func ObfuscatePayload(obfuscator *obfuscate.Obfuscator, tracePayloads []*pb.TracePayload)

ObfuscatePayload applies obfuscator rules to the trace payloads

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

APIConfig defines the API configuration options

func (*APIConfig) GetCensoredKey

func (api *APIConfig) GetCensoredKey() string

GetCensoredKey returns the API key censored for logging purposes

type Config

type Config struct {
	configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.

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

Config defines configuration for the Datadog exporter.

func (*Config) Sanitize

func (c *Config) Sanitize() error

Sanitize tries to sanitize a given configuration

type MetricsConfig

type MetricsConfig struct {
	// Namespace is the namespace under which the metrics are sent
	// By default metrics are not namespaced
	Namespace string `mapstructure:"namespace"`

	// Buckets states whether to report buckets from distribution metrics
	Buckets bool `mapstructure:"report_buckets"`

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

MetricsConfig defines the metrics exporter specific configuration options

type TagsConfig

type TagsConfig struct {
	// Hostname is the host name for unified service tagging.
	// If unset, it is determined automatically.
	// See https://docs.datadoghq.com/agent/faq/how-datadog-agent-determines-the-hostname
	// for more details.
	Hostname string `mapstructure:"hostname"`

	// Env is the environment for unified service tagging.
	// It can also be set through the `DD_ENV` environment variable.
	Env string `mapstructure:"env"`

	// Service is the service for unified service tagging.
	// It can also be set through the `DD_SERVICE` environment variable.
	Service string `mapstructure:"service"`

	// Version is the version for unified service tagging.
	// It can also be set through the `DD_VERSION` version variable.
	Version string `mapstructure:"version"`

	// Tags is the list of default tags to add to every metric or trace.
	Tags []string `mapstructure:"tags"`
}

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

func (*TagsConfig) GetTags

func (t *TagsConfig) GetTags(addHost bool) []string

GetTags gets the default tags extracted from 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"`

	// SampleRate is the rate at which to sample this event. Default is 1,
	// meaning no sampling. If you want to send one event out of every 250
	// times Send() is called, you would specify 250 here.
	SampleRate uint `mapstructure:"sample_rate"`
}

TracesConfig defines the traces exporter specific configuration options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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