Datadog
Overview
The Datadog add-on attaches a sidecar container to your app’s containers to monitor them and your AWS ECS services. Optionally, a second sidecar container can be enabled to capture all log output from your app containers and forward it to Datadog Logging.
Sidecar Containers
A sidecar container is an additional container that runs alongside your main application container within the same task.
Both containers share the same network namespace and can communicate via localhost. They also share the same lifecycle — they start and stop together.
Purpose and Benefits
- Infrastructure Monitoring: Automatically collects metrics from your app containers and AWS ECS services and sends them to Datadog
- Log Aggregation: Optionally capture and forward all container log output to Datadog Logging
- Tagging: Tag metrics and logs by environment and service name to differentiate apps and environments inside Datadog
- Simple Setup: One command attaches the Datadog agent sidecar; no manual agent installation or configuration required
How It Works
The Datadog agent sidecar runs alongside your application containers in the same ECS task. It collects container metrics and forwards them to your Datadog account using your API key. When logging is enabled, a second sidecar container captures stdout/stderr from your app containers and ships the logs to Datadog Logging.
Automatic Environment Variables
When you add the Datadog add-on, Tapitalee automatically injects a set of DD_* environment variables into your application containers based on the settings you provide. This includes:
DD_API_KEY— set from yourdatadog_api_keyDD_SITE— set from yourdatadog_siteDD_TAGS— populated with appropriate tags (e.g. environment and service name)
You do not need to set these variables manually.
StatsD Metrics
Because the Datadog agent sidecar shares the same network namespace as your application container, it also exposes a StatsD listener on localhost:8125 (UDP). This means your application can send custom StatsD metrics directly to localhost on port 8125 without any additional network configuration — they will be picked up by the agent and forwarded to your Datadog account.
Getting a Datadog API Key
- Hover over your account name at the bottom-left of the Datadog UI
- Go to Organization Settings
- Click on API Keys
- Click New API Key and copy the generated key
Viewing Datadog Logs in Tapitalee
When log forwarding is enabled, your primary container logs no longer appear in CloudWatch. If you also provide a datadog_app_key (a Datadog Application Key, found under Organization Settings → Application Keys), Tapitalee will query the logs back from the Datadog API, so show logs and the web Logs tab keep working — including live tail, time ranges, and filtering (using Datadog log search syntax). The application key is optional; without it, logs are only viewable inside Datadog itself.
CLI Usage
Create Datadog Add-On
Create a Datadog integration for monitoring and observability
tapit create datadog datadog_api_key=KEY [datadog_app_key=KEY] [datadog_site=datadoghq.com] [datadog_env=production] [datadog_service=myservice] [enable_logging=true|false] [--ignore-existing]
Parameters
datadog_api_key: Your Datadog API key (required)datadog_app_key: Your Datadog application key (optional, enables viewing Datadog logs via show logs)datadog_site: Datadog site (default: datadoghq.com)datadog_env: Environment tag for Datadog (e.g., production, staging)datadog_service: Service name tag for Datadogenable_logging: Enable log forwarding to Datadog (true/false)--ignore-existing: Skip creation if a resource with the same name already exists (useful for idempotent scripts)
List and Show
List all add-ons attached to the app with their state and configuration
tapit list addons [-w|--wait]
Parameters
-w|--wait: Wait until all add-ons reach a stable state (fully ready or fully deleted); exits non-zero if any add-on is in a failed state
Show detailed information about a specific add-on
tapit show addon name=addon_name
Parameters
name: Name of the add-on to show (required)
Delete Datadog Add-On
Delete an add-on and all its associated AWS resources
tapit delete addon name=addon_name
Parameters
name: Name of the add-on to delete (required)