Datadog Support for Fargate
Bringing Fargate Metrics into Datadog requires a special agent that can be added to any Fargate container.
Datadog has written a nice guide for installing the agent manually (opens in a new tab).
This manual integration will not work with Flightcontrol services, unfortunately. With Flightcontrol, the Task Definition gets overridden with each new deployment.
What we need to do is to automatically add the Datadog agent to the Task Definition during the service deployment.
We have added an experimental feature to enable Datadog logging for your Fargate service. This is currently supported through our flightcontrol.json
configuration only, we will be adding this feature to our Dashboard in the near future.
- In your
flightcontrol.json
file, please add the new experimentaldatadog
object. - Also add the relative Docker Labels, so Datadog can correctly tag the logs and metrics.
Here is a complete example:
{
"id": "web",
"name": "web",
"type": "fargate",
"cpu": 0.5,
"memory": 1,
"minInstances": 1,
"maxInstances": 1,
"dockerLabels": {
"com.datadoghq.ad.instances": "[{\"host\": \"%%host%%\", \"port\": 3000}]", //change the port if needed
"com.datadoghq.ad.check_names": "[\"DISPLAY_NAME\"]", // name that will show in datadog
"com.datadoghq.ad.init_configs": "[{}]"
},
"experimental": {
// make sure the datadog object is added under experimental
"datadog": {
"enabled": true,
"datadogSite": "us5.datadoghq.com", //plaintext
"datadogApiKey": "<REFRENCE_TO_DD_API_KEY_IN_AWS_PARAMETER_STORE>" //from parameter store, needs to be manually added
"envVariables": {
// Environment variables to pass to the datadog agent
// Similar to regular services variables
"DD_APM_ENABLED": true,
}
}
}
}
Note: The DataDog agent requires 256MB of memory to run, make sure you configure your instance with enough memory for both your application and the DataDog agent. It is recommended to use the DataDog agent with an instance size of minimum 1GB of memory.