Awsecscontainermetrics Receiver
contrib
Maintainers: @Aneurysm9
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
Overview
AWS ECS Container Metrics Receiver (awsecscontainermetrics) reads task metadata and docker stats from Amazon ECS Task Metadata Endpoint, and generates resource usage metrics (such as CPU, memory, network, and disk) from them. To get the full list of metrics, see the Available Metrics section below.
This receiver works only for ECS Task Metadata Endpoint V4. Amazon ECS tasks on Fargate that use platform version 1.4.0 or later and Amazon ECS tasks on Amazon EC2 that are running at least version 1.39.0 of the Amazon ECS container agent can utilize this receiver. For more information, see Amazon ECS Container Agent Versions.
Configuration
Example:collection_interval:
This receiver collects task metadata and container stats at a fixed interval and emits metrics to the next consumer of OpenTelemetry pipeline.collection_interval will determine the frequency at which metrics are collected and emitted by this receiver.
default: 20s
Enabling the AWS ECS Container Metrics Receiver
To enable the awsecscontainermetrics receiver, add the name under receiver section in the OpenTelemetry config file. By default, the receiver scrapes the ECS task metadata endpoint every 20s and collects all metrics (For the full list of metrics, see Available Metrics). The following configuration collects AWS ECS resource usage metrics by usingawsecscontainermetrics receiver and sends them to CloudWatch using awsemf exporter. Check out SETUP section for configuring AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service.
Set Metrics Collection Interval
Customers can configurecollection_interval under awsecscontainermetrics receiver to scrape and gather metrics at a specific interval. The following example configuration will collect metrics every 40 seconds.
Collect specific metrics and update metric names
The previous configurations collect all the metrics and sends them to Amazon CloudWatch using default names. Customers can usefilter and metricstransform processors to send specific metrics and rename them respectively.
The following configuration example collects only the ecs.task.memory.utilized metric and renames it to MemoryUtilized before sending to CloudWatch.
Available Metrics
Following is the full list of metrics emitted by this receiver.| Task Level Metrics | Container Level Metrics | Unit |
|---|---|---|
| ecs.task.memory.usage | container.memory.usage | Bytes |
| ecs.task.memory.usage.max | container.memory.usage.max | Bytes |
| ecs.task.memory.usage.limit | container.memory.usage.limit | Bytes |
| ecs.task.memory.reserved | container.memory.reserved | MiB |
| ecs.task.memory.utilized | container.memory.utilized | MiB |
| ecs.task.cpu.usage.total | container.cpu.usage.total | Nanoseconds |
| ecs.task.cpu.usage.kernelmode | container.cpu.usage.kernelmode | Nanoseconds |
| ecs.task.cpu.usage.usermode | container.cpu.usage.usermode | Nanoseconds |
| ecs.task.cpu.usage.system | container.cpu.usage.system | Nanoseconds |
| ecs.task.cpu.usage.vcpu | container.cpu.usage.vcpu | vCPU |
| ecs.task.cpu.cores | container.cpu.cores | Count |
| ecs.task.cpu.onlines | container.cpu.onlines | Count |
| ecs.task.cpu.reserved | container.cpu.reserved | vCPU |
| ecs.task.cpu.utilized | container.cpu.utilized | Percent |
| ecs.task.network.rate.rx | container.network.rate.rx | Bytes/Second |
| ecs.task.network.rate.tx | container.network.rate.tx | Bytes/Second |
| ecs.task.network.io.usage.rx_bytes | container.network.io.usage.rx_bytes | Bytes |
| ecs.task.network.io.usage.rx_packets | container.network.io.usage.rx_packets | Count |
| ecs.task.network.io.usage.rx_errors | container.network.io.usage.rx_errors | Count |
| ecs.task.network.io.usage.rx_dropped | container.network.io.usage.rx_dropped | Count |
| ecs.task.network.io.usage.tx_bytes | container.network.io.usage.tx_bytes | Bytes |
| ecs.task.network.io.usage.tx_packets | container.network.io.usage.tx_packets | Count |
| ecs.task.network.io.usage.tx_errors | container.network.io.usage.tx_errors | Count |
| ecs.task.network.io.usage.tx_dropped | container.network.io.usage.tx_dropped | Count |
| ecs.task.storage.read_bytes | container.storage.read_bytes | Bytes |
| ecs.task.storage.write_bytes | container.storage.write_bytes | Bytes |
| ecs.task.ephemeral_storage.utilized | MiB | |
| ecs.task.ephemeral_storage.reserved | MiB |
Resource Attributes and Metrics Labels
Metrics emitted by this receiver comes with a set of resource attributes. These resource attributes can be converted to metrics labels using appropriate processors/exporters (SeeFull Configuration Examples section below). Finally, these metrics labels can be set as metrics dimensions while exporting to desired destinations. Check the following table to see available resource attributes for Task and Container level metrics. Container level metrics have three additional attributes than task level metrics.
| Resource Attributes for Task Level Metrics | Resource Attributes for Container Level Metrics |
|---|---|
| aws.ecs.cluster.name | aws.ecs.cluster.name |
| aws.ecs.task.family | aws.ecs.task.family |
| aws.ecs.task.arn | aws.ecs.task.arn |
| aws.ecs.task.id | aws.ecs.task.id |
| aws.ecs.task.revision | aws.ecs.task.revision |
| aws.ecs.service.name | aws.ecs.service.name |
| cloud.availability_zone | cloud.availability_zone |
| cloud.account.id | cloud.account.id |
| cloud.region | cloud.region |
| aws.ecs.task.pull_started_at | aws.ecs.container.started_at |
| aws.ecs.task.pull_stopped_at | aws.ecs.container.finished_at |
| aws.ecs.task.known_status | aws.ecs.container.know_status |
| aws.ecs.launch_type | aws.ecs.launch_type |
| Â | aws.ecs.container.created_at |
| Â | container.name |
| Â | container.id |
| Â | aws.ecs.docker.name |
| Â | container.image.tag |
| Â | aws.ecs.container.image.id |
| Â | aws.ecs.container.exit_code |
Full Configuration Examples
This receiver emits 54 unique metrics. Customer may not want to send all of them to destinations. Following sections will show full configuration files for filtering and transforming existing metrics with different processors/exporters.1. Full configuration for task level metrics
The following example shows a full configuration to get most useful task level metrics. It usesawsecscontainermetrics receiver to collect all the resource usage metrics from ECS task metadata endpoint. It applies filter processor to select only 8 task-level metrics and update metric names using metricstransform processor. It also renames the resource attributes using resource processor which will be used as metric dimensions in the Amazon CloudWatch awsemf exporter. Finally, it sends the metrics to CloudWatch using awsemf exporter under the /aws/ecs/containerinsights/{ClusterName}/performance namespace where the {ClusterName} placeholder will be replaced with actual cluster name. Check the AWS EMF Exporter documentation to see and explore the metrics in Amazon CloudWatch.
Note: AWS OpenTelemetry Collector has a default configuration backed into it for Container Insights experience which is similar to this one. Follow our setup doc to check how to use that default config.
2. Full configuration for task- and container-level metrics
The following example shows a full configuration to get most useful task- and container-level metrics. It usesawsecscontainermetrics receiver to collect all the resource usage metrics from ECS task metadata endpoint. It applies filter processor to select only 8 task- and container-level metrics and update metric names using metricstransform processor. It also renames the resource attributes using resource processor which will be used as metric dimensions in the Amazon CloudWatch awsemf exporter. Finally, it sends the metrics to CloudWatch using awsemf exporter under the /aws/ecs/containerinsights/{ClusterName}/performance namespace where the {ClusterName} placeholder will be replaced with actual cluster name. Check the AWS EMF Exporter documentation to see and explore the metrics in Amazon CloudWatch.
Reference
- Setup OpenTelemetry Collector on Amazon ECS
- Getting Started with ECS Container Metrics Receiver in the OpenTelemetry Collector
Configuration
Example Configuration
Last generated: 2026-04-13