Skip to content

ECS Managed Instances - Parse ECS /tasks metadata endpoint#47688

Draft
stzou wants to merge 1 commit intomainfrom
stzou/EXP-309
Draft

ECS Managed Instances - Parse ECS /tasks metadata endpoint#47688
stzou wants to merge 1 commit intomainfrom
stzou/EXP-309

Conversation

@stzou
Copy link
Copy Markdown
Contributor

@stzou stzou commented Mar 10, 2026

What does this PR do?

Adds support for parsing the ECS /tasks metadata endpoint on ECS Managed Instances, and wires the new DaemonName field through to workloadmeta and the orchestrator transformer.

pkg/util/ecs/metadata/v3or4

  • Add DaemonName string to the Task struct (populated from the new DaemonName field in the /tasks response, analogous to ServiceName)
  • Add tasksMetadataPath = "/tasks" constant and GetTasks(ctx) ([]Task, error) to the Client interface and implementation — calls ${ECS_CONTAINER_METADATA_URI_V4}/tasks to return all host tasks in a single call

comp/core/workloadmeta

  • Add DaemonName string to the ECSTask entity in def/types.go
  • Wire DaemonName: task.DaemonName in ParseV4Task (collectors/util/ecs_util.go)

comp/core/workloadmeta/collectors/internal/ecs

  • Add parseTasksFromV4TasksEndpoint: fetches all host tasks via GetTasks() in a single call and parses them with ParseV4Task. This replaces the v1-enumerate + per-task-v4-fetch pattern.
  • setTaskCollectionParserForDaemon: selects parseTasksFromV4TasksEndpoint when running on Managed Instances with a v4 endpoint available

pkg/collector/corechecks/cluster/orchestrator/transformers/ecs/task.go

  • Wire DaemonName: task.Task.DaemonName in ExtractECSTask to populate the agent-payload proto field

go.mod

Motivation

With the release of Daemon Scheduling on ECS Managed Instances, AWS has added a new host-level /tasks endpoint that returns all tasks on the host, including a DaemonName field for daemon tasks.

This is the agent-side prerequisite for correct ecs_daemon_name, daemon_arn, and task_definition_arn tagging in the backend.

Describe how you validated your changes

Unit tests added for:

  • GetTasks client method (client_test.go)
  • parseTasksFromV4TasksEndpoint in the ECS workloadmeta collector (v4parser_test.go, daemon_parser_test.go)
  • ExtractECSTask with DaemonName populated (task_test.go — existing tests still pass)

Additional Notes

  • The /tasks endpoint has no WithTags variant, so EC2 resource tags are not collected via this path. This is expected — HasEC2ResourceTags() returns false on Managed Instances.

@dd-octo-sts dd-octo-sts bot added the internal Identify a non-fork PR label Mar 10, 2026
@github-actions github-actions bot added the long review PR is complex, plan time to review it label Mar 10, 2026
@dd-octo-sts dd-octo-sts bot added team/ecs-experiences Issues and PRs owned by the ECS Experiences team team/container-platform The Container Platform Team labels Mar 10, 2026
@agent-platform-auto-pr
Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor 1dfe3dab:

Results for datadog-agent_7.78.0~devel.git.493.7b72a79.pipeline.101754328-1_amd64.deb:

No change detected

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts bot commented Mar 27, 2026

This pull request has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this pull request is still relevant, adding a comment or pushing new commits will keep it open. Also, you can always reopen the pull request if you missed the window.

Thank you for your contributions!

@dd-octo-sts dd-octo-sts bot added the stale label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Identify a non-fork PR long review PR is complex, plan time to review it stale team/container-platform The Container Platform Team team/ecs-experiences Issues and PRs owned by the ECS Experiences team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant