License your Amazon ECS tasks per container-hour with Container Application Monitoring. This works with OneAgent and OpenTelemetry, on both AWS Fargate and Amazon EC2.
OneAgent version 1.345+
Both options require OneAgent version 1.345+. Use one of these options:
builtin:billing.container-application-monitoring.optin to opt in all eligible OneAgent containers on ECS and Kubernetes at once. A container is eligible if its telemetry carries the container identity attributes. The setting is enabled by default for new customers and needs no task definition changes. Once you enable it, you can't disable it.dt.has_container_application_monitoring=true to OTEL_RESOURCE_ATTRIBUTES on your application containers. OneAgent reads this variable. To revert, remove it and deploy a new revision.{"name": "OTEL_RESOURCE_ATTRIBUTES","value": "dt.has_container_application_monitoring=true"}
Set the variable on every application container in the task definition, not on the container that provides the OneAgent code modules. If you already set OTEL_RESOURCE_ATTRIBUTES, append the attribute to the comma-separated list.
OneAgent adds the container ARN to its telemetry automatically.
The tenant-wide setting applies to OneAgent only. OpenTelemetry tasks are licensed as Container Application Monitoring only if their telemetry carries dt.has_container_application_monitoring=true.
Your telemetry needs two resource attributes:
dt.has_container_application_monitoring=trueaws.ecs.container.arn, the ARN of the container the telemetry comes fromMost OpenTelemetry SDKs and the Collector include the AWS ECS resource detector, which sets aws.ecs.container.arn automatically. Enable the detector, and add the opt-in attribute to OTEL_RESOURCE_ATTRIBUTES:
{"name": "OTEL_RESOURCE_ATTRIBUTES","value": "dt.has_container_application_monitoring=true"}
If you can't use the resource detector, read the container ARN at startup, for example, in an entrypoint script. Get ContainerARN from the task metadata endpoint (${ECS_CONTAINER_METADATA_URI_V4}) and add it to OTEL_RESOURCE_ATTRIBUTES as aws.ecs.container.arn=<ARN>.
Without aws.ecs.container.arn, Dynatrace can't attribute telemetry to a container. That telemetry is licensed as Traces and Metrics - Ingest & Process instead.
Don't opt in OpenTelemetry tasks on EC2 instances that also run the OneAgent daemon service. These instances are already licensed through host monitoring. Opting their containers in would license them twice.
All containers from the same cluster and task-definition family must be opted in together. Partial opt-in within a family isn't supported and can result in incorrect licensing.
In Account Management, go to Subscription > Overview > Cost and usage details, select Container Application Monitoring, and check that consumption increases. You can also query billing usage events, as described in Migrate to Container Application Monitoring.