datadog

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package datadog provides a Datadog observability provider for observops. It uses OpenTelemetry Protocol (OTLP) to send telemetry data to Datadog via the Datadog Agent or directly to Datadog's OTLP endpoints.

Usage

import (
	"github.com/agentplexus/omniobserve/observops"
	_ "github.com/agentplexus/omniobserve/observops/datadog"
)

provider, err := observops.Open("datadog",
	observops.WithEndpoint("localhost:4317"), // Datadog Agent OTLP endpoint
	observops.WithServiceName("my-service"),
)

Configuration

When using the Datadog Agent (recommended):

  • Endpoint: localhost:4317 (default) for gRPC or localhost:4318 for HTTP
  • Ensure the Datadog Agent has OTLP ingestion enabled

When sending directly to Datadog:

  • Endpoint: Use Datadog's intake endpoint for your region
  • API Key: Your Datadog API key

Environment Variables

Standard OpenTelemetry environment variables are respected:

  • OTEL_EXPORTER_OTLP_ENDPOINT
  • OTEL_SERVICE_NAME
  • DD_SITE (for direct ingestion: datadoghq.com, datadoghq.eu, etc.)
  • DD_API_KEY (for direct ingestion)

Datadog Agent Configuration

Enable OTLP ingestion in your datadog.yaml:

otlp_config:
  receiver:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

Index

Constants

View Source
const (
	// DefaultAgentEndpoint is the default Datadog Agent OTLP endpoint.
	DefaultAgentEndpoint = "localhost:4317"
)

Variables

This section is empty.

Functions

func New

New creates a new Datadog provider.

func WithDatadogEnv

func WithDatadogEnv(env string) observops.ClientOption

WithDatadogEnv sets the Datadog environment tag.

func WithDatadogSite

func WithDatadogSite(site Site) observops.ClientOption

WithDatadogSite sets the Datadog site for direct ingestion.

func WithDatadogVersion

func WithDatadogVersion(version string) observops.ClientOption

WithDatadogVersion sets the Datadog version tag.

Types

type Provider

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

Provider implements observops.Provider for Datadog.

func (*Provider) ForceFlush

func (p *Provider) ForceFlush(ctx context.Context) error

ForceFlush forces any buffered telemetry to be exported.

func (*Provider) Logger

func (p *Provider) Logger() observops.Logger

Logger returns the structured logger.

func (*Provider) Meter

func (p *Provider) Meter() observops.Meter

Meter returns the metric meter.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the provider.

func (*Provider) Tracer

func (p *Provider) Tracer() observops.Tracer

Tracer returns the tracer.

type Site

type Site string

Site represents a Datadog datacenter site.

const (
	SiteUS1 Site = "datadoghq.com"
	SiteUS3 Site = "us3.datadoghq.com"
	SiteUS5 Site = "us5.datadoghq.com"
	SiteEU1 Site = "datadoghq.eu"
	SiteAP1 Site = "ap1.datadoghq.com"
)

Jump to

Keyboard shortcuts

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