Integrating Databrain with Datadog
This guide explains how to send OpenTelemetry traces, metrics, and logs from your self-hosted Databrain instance to Datadog.Prerequisites
- Databrain self-hosted version with OpenTelemetry support
- Datadog account with APM enabled
- Datadog API key
Configuration
1. Get Your Datadog API Key
- Log into your Datadog account
- Navigate to Organization Settings → API Keys
- Copy an existing API key or create a new one
2. Determine Your Datadog Site
Identify your Datadog site (region):| Site | OTLP Endpoint |
|---|---|
| US1 (default) | https://api.datadoghq.com |
| US3 | https://api.us3.datadoghq.com |
| US5 | https://api.us5.datadoghq.com |
| EU | https://api.datadoghq.eu |
| US1-FED | https://api.ddog-gov.com |
| AP1 | https://api.ap1.datadoghq.com |
3. Configure Databrain Environment Variables
Add these environment variables to your Databrain backend:4. Docker Compose Configuration
Update yourdocker-compose.yml:
DD_API_KEY in a .env file, not directly in docker-compose.yml.
5. Kubernetes Configuration
For Kubernetes deployments:Alternative: Using Datadog Agent
For better performance and additional features, use the Datadog Agent as an OTLP collector:1. Deploy Datadog Agent
Docker Compose:What Gets Sent to Datadog
Once configured, Databrain automatically sends:| Telemetry Type | Datadog Product | Description |
|---|---|---|
| Traces | APM | API request spans with timing, status codes, and errors |
| Metrics | Metrics | Request latency histograms, error rates, throughput |
| Logs | Log Management | Correlated logs with trace context (trace_id, span_id) |
Verification
1. Restart Databrain
2. Generate Test Traffic
Make a few API requests to your Databrain instance:3. Check Datadog UI
-
APM Traces:
- Navigate to APM → Traces
- Filter by
service:databrain-api - You should see traces within 1-2 minutes
-
Service Map:
- Go to APM → Service Map
- Look for
databrain-apiand its dependencies (PostgreSQL, Redis, etc.)
-
Metrics:
- Navigate to Metrics → Explorer
- Search for
trace.http.request.durationorhttp.server.duration
-
Logs:
- Go to Logs → Search
- Filter by
service:databrain-api - Click on a log entry to see correlated traces
Custom Tags and Attributes
Add custom tags to all telemetry:Advanced Configuration
Sampling Configuration
To reduce costs, configure trace sampling in the Datadog Agent:Resource Attributes
Databrain automatically includes these resource attributes:service.name- Your service name (databrain-api)service.version- Databrain versiondeployment.environment- From DD_ENVhost.name- Container/pod hostname
Troubleshooting
| Issue | Solution |
|---|---|
| No data in Datadog | Verify OTEL_ENABLED=true and DD_API_KEY is correct |
| 403 Forbidden | Check API key has APM permissions in Datadog |
| Connection timeout | Verify endpoint URL matches your Datadog site |
| Missing traces | Wait 2-3 minutes; Datadog has ingestion delay |
| High costs | Implement sampling in Datadog Agent configuration |
Debug Mode
Enable debug logging to troubleshoot:Verify Agent Connectivity (if using Agent)
Check Datadog Agent logs:Datadog Features
APM Dashboard
Datadog APM provides:- Service Overview: Latency percentiles (p50, p75, p95, p99), throughput, error rates
- Flame Graphs: Visual representation of trace spans
- Deployment Tracking: Compare performance before/after deployments
- Error Tracking: Automatic error detection and grouping
Log Correlation
Click on any trace in Datadog APM to see:- All logs generated during that request
- Database queries executed
- External API calls made
- Full request/response context
Alerts
Set up monitors in Datadog:Pricing Considerations
Datadog pricing is based on:- Indexed Spans: Number of traces retained for search
- Ingested Spans: Total spans sent (used for metrics)
- Custom Metrics: Number of unique metric timeseries
- Use sampling to reduce indexed spans (keeps metrics accurate)
- Filter low-value traces (health checks, static assets)
- Use the Datadog Agent for local aggregation
- Set retention periods appropriately
Support
- Datadog Documentation: https://docs.datadoghq.com/tracing/
- Datadog Support: Available via in-app chat or email
- OpenTelemetry Compatibility: https://docs.datadoghq.com/tracing/trace_collection/otel_instrumentation/

