Datadog & Cloud Monitoring
Harness the power of enterprise-grade observability with GO-DUCK's native Datadog integration for logs, metrics, and APM.
Overview
GO-DUCK provides a specialized logger package that abstracts the complexity of streaming logs and metrics to Datadog. It supports environment-based configuration, ensuring you only pay for what you need in production while keeping local development logs clean.
Log Streaming
Our logger is designed to be Datadog-ready. When datadog.enabled is set to true, logs are formatted as JSON and sent directly to the Datadog API or via a local Datadog Agent.
Pro-Tip: Use structured logging with logger.Info("User logged in", zap.String("userID", user.ID)) to enable powerful faceted searches in the Datadog Log Explorer.
Configuration
go-duck:
logging:
level: "info"
datadog:
enabled: true
api-key: "${DD_API_KEY}"
site: "datadoghq.com"
service: "go-duck-master-app"
env: "production"
Custom Metrics (DogStatsD)
The generated code includes a pre-initialized Statsd client. You can push custom business metrics directly from your Go services:
logger.Count("orders.placed", 1, tags, 1.0)- Tracks volume.logger.Histogram("payment.latency", duration, tags, 1.0)- Tracks performance distribution.logger.Gauge("active.users", count, tags, 1.0)- Tracks point-in-time value.