datadog

package module
v0.0.0-...-686cb12 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

README

OpenCensus Go Datadog

CircleCI GoDoc

Provides OpenCensus stats and trace exporter support for Datadog Metrics and Datadog APM. The examples folder provides some simple usage examples.

Requirements:
Contributing

Please make sure to read through our contribution guidelines before opening an issue or a Pull Request.

Disclaimer

In order to get accurate Datadog APM statistics and full distributed tracing, trace sampling must be done by the Datadog stack. For this to be possible, OpenCensus must be notified to forward all traces to our exporter:

trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})

This change simply means that Datadog will handle sampling. It does not mean that all traces will be sampled.

Documentation

Overview

Package datadog contains a Datadog exporter for OpenCensus.

Index

Constants

View Source
const (
	// DefaultStatsAddrUDP specifies the default protocol (UDP) and address
	// for the DogStatsD service.
	DefaultStatsAddrUDP = "localhost:8125"

	// DefaultStatsAddrUDS specifies the default socket address for the
	// DogStatsD service over UDS. Only useful for platforms supporting unix
	// sockets.
	DefaultStatsAddrUDS = "unix:///var/run/datadog/dsd.socket"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

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

Exporter exports stats to Datadog.

func NewExporter

func NewExporter(o Options) (exporter *Exporter, err error)

NewExporter returns an exporter that exports stats and traces to Datadog. When using trace, it is important to call Stop at the end of your program for a clean exit and to flush any remaining tracing data to the Datadog agent. If an error occurs initializing the stats exporter, the error will be returned and the exporter will be nil.

func (*Exporter) ExportSpan

func (e *Exporter) ExportSpan(s *trace.SpanData)

ExportSpan implements trace.Exporter.

func (*Exporter) ExportView

func (e *Exporter) ExportView(vd *view.Data)

ExportView implements view.Exporter.

func (*Exporter) Stop

func (e *Exporter) Stop()

Stop cleanly stops the exporter, flushing any remaining spans and stats to the transport and reporting any errors. Make sure to always call Stop at the end of your program in order to not lose any tracing data. Only call Stop once per exporter. Repeated calls will cause panic.

type Options

type Options struct {
	// Namespace specifies the namespaces to which metric keys are appended.
	Namespace string

	// Service specifies the service name used for tracing.
	Service string

	// TraceAddr specifies the host[:port] address of the Datadog Trace Agent.
	// It defaults to localhost:8126.
	TraceAddr string

	// StatsAddr specifies the host[:port] address for DogStatsD. It defaults
	// to localhost:8125.
	StatsAddr string

	// OnError specifies a function that will be called if an error occurs during
	// processing stats or metrics.
	OnError func(err error)

	// Tags specifies a set of global tags to attach to each metric.
	Tags []string

	// GlobalTags holds a set of tags that will automatically be applied to all
	// exported spans.
	GlobalTags map[string]interface{}

	// DisableCountPerBuckets specifies whether to emit count_per_bucket metrics
	DisableCountPerBuckets bool
}

Options contains options for configuring the exporter.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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