datadog

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package datadog is a logging sink that sends records to Datadog's log intake (HTTP API v2):

datadog.New(datadog.Options{}) // DD_API_KEY, DD_SITE, DD_SERVICE, DD_ENV…

Records logged in a request with a trusted traceparent carry its trace as dd.trace_id and dd.span_id, in the form Datadog's APM joins on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// APIKey is the key logs are sent with. The default is DD_API_KEY's.
	APIKey string
	// Site is the Datadog site, such as datadoghq.eu. The default is
	// DD_SITE's, or datadoghq.com.
	Site string
	// URL replaces the intake address made from Site.
	URL string
	// Service, Env, Version, Hostname and Tags describe where the logs
	// come from. The defaults are DD_SERVICE (or the program's name),
	// DD_ENV, DD_VERSION, the host's name and DD_TAGS.
	Service, Env, Version, Hostname string
	Tags                            []string
	// Source is ddsource. The default is "go".
	Source string
	// NoGzip sends requests uncompressed.
	NoGzip bool
	// Client sends the requests. The default is http.DefaultClient.
	Client *http.Client
}

Options configures the sink. Unset fields come from the environment variables Datadog's agents read.

type Sink

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

Sink sends to Datadog. Make one with New.

func New

func New(o Options) *Sink

New returns a Datadog sink.

func (*Sink) Export

func (s *Sink) Export(ctx context.Context, entries []logging.Entry) error

Export implements logging.Sink.

func (*Sink) Name

func (*Sink) Name() string

Name implements the name logging reports errors with.

Jump to

Keyboard shortcuts

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