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 ¶
const (
// DefaultAgentEndpoint is the default Datadog Agent OTLP endpoint.
DefaultAgentEndpoint = "localhost:4317"
)
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...observops.ClientOption) (observops.Provider, error)
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 ¶
ForceFlush forces any buffered telemetry to be exported.