The AWS Distro for OpenTelemetry has many features for collecting telemetry from your applications. In this tutorial, you will learn how to quickly enable resource utilization monitoring for Fluent Bit using ADOT. OpenTelemetry can do a lot more than is shown in this tutorial.
This guide is broken down into two tutorials:
- Tutorial 1: Quickly Enable Task Resource Monitoring
- Tutorial 2: Enable Container Level Metric Collection
To quickly enable CPU, memory, network and disk usage metrics for your FireLens task, simply add the following container definition to your current task definition:
{
"essential": true,
"image": "public.ecr.aws/aws-observability/aws-otel-collector:latest",
"name": "aws-otel-collector",
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "aws-otel-collector",
"awslogs-region": "us-west-1",
"awslogs-create-group": "true",
"awslogs-stream-prefix": "ecs-"
}
},
"memoryReservation": 100,
"command": [
"--config=/etc/ecs/container-insights/otel-task-metrics-config.yaml"
]
}
This uses the built-in ADOT configuration for ECS Task Level Metrics. Please read the full documentation.
This configuration will send metrics to CloudWatch with the following sets of dimensions:
ClusterName
ClusterName
andTaskDefinitionFamily
This means that you will get CPU, Memory, Disk, and Network metrics for the entire task aggregated across your cluster, and the union of cluster and TaskDefinition Family.
For this tutorial, you must do the following:
- Copy the "Full configuration for task- and container-level metrics" example from the ADOT ECS Documentation.
- Optionally modify the dimensions and metrics sent to CloudWatch with the
awsemf
exporter. For example, you could addTaskId
andContainerName
as dimensions to monitoring specific Fluent Bit containers. However, please understand that this will lead to a very large number of individual metrics in CloudWatch which will induce cost. - Follow the ADOT ECS Custom Config tutorial to run ADOT with your custom configuration.