Add daemonName field to ECSTask proto#456
Merged
Merged
Conversation
Alos222
approved these changes
May 1, 2026
stzou
added a commit
to DataDog/datadog-agent
that referenced
this pull request
May 1, 2026
Bump agent-payload to a pseudo-version that includes the new daemonName proto field (DataDog/agent-payload#456) and propagate task.Task.DaemonName through ExtractECSTask so the orchestrator emits the daemon identifier to the backend. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kkhor-datadog
approved these changes
May 1, 2026
JLineaweaver
approved these changes
May 1, 2026
stzou
added a commit
to DataDog/datadog-agent
that referenced
this pull request
May 1, 2026
DataDog/agent-payload#456 was merged and tagged as v5.0.195. Move off the pseudo-version onto the released tag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stzou
added a commit
to DataDog/datadog-agent
that referenced
this pull request
May 6, 2026
Bump agent-payload to a pseudo-version that includes the new daemonName proto field (DataDog/agent-payload#456) and propagate task.Task.DaemonName through ExtractECSTask so the orchestrator emits the daemon identifier to the backend. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stzou
added a commit
to DataDog/datadog-agent
that referenced
this pull request
May 6, 2026
DataDog/agent-payload#456 was merged and tagged as v5.0.195. Move off the pseudo-version onto the released tag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
May 7, 2026
### What does this PR do?
Adds support for parsing the ECS `/tasks` host metadata endpoint on ECS Managed Instances, and wires daemon-task identification through workloadmeta and the orchestrator transformer so the backend can produce `ecs_daemon_name` / `daemon-task-definition` tags.
**`pkg/util/ecs/metadata/v3or4`**
- Add `Group` field to the `Task` struct. AWS uses `Group` (with the `service:` / `daemon:` / `family:` prefix
convention) on the `/tasks` host endpoint to identify a task's scheduling owner. The per-task `/task` and
`/taskWithTags` endpoints do not return it.
- Add `tasksMetadataPath = "/tasks"` constant and `GetTasks(ctx) ([]Task, error)` on the `Client` interface and
implementation.
**`comp/core/workloadmeta`**
- Add `DaemonName` and `DaemonARN` fields to the `ECSTask` entity (`def/types.go`, both `proto:"ignore"` like the
other resolved-name fields).
- Add `BuildDaemonARN()` helper in `collectors/util/ecs_util.go` and `parseDaemonNameFromGroup()` to derive the daemon
name from a `daemon:`-prefixed `Group`.
- In `ParseV4Task`, populate `DaemonName` and `DaemonARN` for daemon-scheduled tasks.
**`comp/core/workloadmeta/collectors/internal/ecs`**
- Add `parseTasksFromV4TasksEndpoint`: fetches all host tasks via `metaV4.GetTasks()` in a single call.
- `setTaskCollectionParserForDaemon`: select the new parser when running on Managed Instances with a v4 client
available; fall back to the existing per-task parser on EC2.
- `initializeDaemonMode`: opportunistically build a v4 client for the agent's own container (`V4FromCurrentTask`) so
the new parser is available.
**`comp/core/tagger`**
- Add `EcsDaemonName` (`ecs_daemon`) and `EcsDaemonARN` (`daemon_arn`) tag constants in `tags/tags.go`.
- Emit those tags from `collectors/workloadmeta_extract.go`, mirroring the existing `ecs_service` / `service_arn`
plumbing for service tasks.
**`pkg/collector/corechecks/cluster/orchestrator/transformers/ecs/task.go`**
- Wire `DaemonName: task.Task.DaemonName` into `ExtractECSTask` so the agent-payload `daemonName` proto field is
populated.
**`go.mod`** (and sub-modules)
- Bump `agent-payload` to `v5.0.195`, which includes the new `daemonName` field on the `ECSTask` proto
([DataDog/agent-payload#456](DataDog/agent-payload#456)).
### Motivation
With ECS Managed Instances daemon scheduling, a single agent runs once per host and needs to enumerate every task on the instance. AWS shipped the new `/tasks` host endpoint for this, and exposes `Group` (rather than the originally proposed `DaemonName` field) as the daemon-task discriminator.
This is the agent-side prerequisite for correct `ecs_daemon_name` and `daemon-task-definition-arn` tagging in the backend.
### Describe how you validated your changes
**Unit tests**
- `GetTasks` on the v3or4 client.
- `parseTasksFromV4TasksEndpoint` in the workloadmeta collector — daemon-name derivation from `Group` and stale-task
unset behavior.
- `setTaskCollectionParserForDaemon` — selection on Managed Instances vs. EC2.
- `BuildDaemonARN` and `parseDaemonNameFromGroup` (incl. the theoretical `"daemon:"` empty suffix).
- `TestParseV4TaskDaemonGroup` / `TestParseV4TaskServiceGroup` — end-to-end population of DaemonName/DaemonARN vs.
ServiceName/ServiceARN on the `ECSTask` entity.
- `TestHandleECSTask` — new "ECS Managed Instances daemon task" case asserts `daemon_arn` and `ecs_daemon` tag
emission.
- `ExtractECSTask` continues to populate `DaemonName` on the proto.
Deployed agent onto ECS MI using a daemon:
- confirmed that ECS tasks are reported and appear under ECS Explorer
<img width="1051" height="407" alt="image" src="https://github.com/user-attachments/assets/923ffed6-58e6-4ab1-892e-fb437d3e8249" />
- we're also able to extract relevant daemon tags
<img width="776" height="102" alt="image" src="https://github.com/user-attachments/assets/31ece2fd-a8ef-4f75-b5ce-e67a9ed65956" />
- daemon_arn and ecs_daemon present on metrics
<img width="852" height="147" alt="image" src="https://github.com/user-attachments/assets/542d9d11-e485-453f-ba98-6e3d7b6bd6f5" />
Co-authored-by: steve.zou <steve.zou@datadoghq.com>
chouetz
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
May 13, 2026
### What does this PR do?
Adds support for parsing the ECS `/tasks` host metadata endpoint on ECS Managed Instances, and wires daemon-task identification through workloadmeta and the orchestrator transformer so the backend can produce `ecs_daemon_name` / `daemon-task-definition` tags.
**`pkg/util/ecs/metadata/v3or4`**
- Add `Group` field to the `Task` struct. AWS uses `Group` (with the `service:` / `daemon:` / `family:` prefix
convention) on the `/tasks` host endpoint to identify a task's scheduling owner. The per-task `/task` and
`/taskWithTags` endpoints do not return it.
- Add `tasksMetadataPath = "/tasks"` constant and `GetTasks(ctx) ([]Task, error)` on the `Client` interface and
implementation.
**`comp/core/workloadmeta`**
- Add `DaemonName` and `DaemonARN` fields to the `ECSTask` entity (`def/types.go`, both `proto:"ignore"` like the
other resolved-name fields).
- Add `BuildDaemonARN()` helper in `collectors/util/ecs_util.go` and `parseDaemonNameFromGroup()` to derive the daemon
name from a `daemon:`-prefixed `Group`.
- In `ParseV4Task`, populate `DaemonName` and `DaemonARN` for daemon-scheduled tasks.
**`comp/core/workloadmeta/collectors/internal/ecs`**
- Add `parseTasksFromV4TasksEndpoint`: fetches all host tasks via `metaV4.GetTasks()` in a single call.
- `setTaskCollectionParserForDaemon`: select the new parser when running on Managed Instances with a v4 client
available; fall back to the existing per-task parser on EC2.
- `initializeDaemonMode`: opportunistically build a v4 client for the agent's own container (`V4FromCurrentTask`) so
the new parser is available.
**`comp/core/tagger`**
- Add `EcsDaemonName` (`ecs_daemon`) and `EcsDaemonARN` (`daemon_arn`) tag constants in `tags/tags.go`.
- Emit those tags from `collectors/workloadmeta_extract.go`, mirroring the existing `ecs_service` / `service_arn`
plumbing for service tasks.
**`pkg/collector/corechecks/cluster/orchestrator/transformers/ecs/task.go`**
- Wire `DaemonName: task.Task.DaemonName` into `ExtractECSTask` so the agent-payload `daemonName` proto field is
populated.
**`go.mod`** (and sub-modules)
- Bump `agent-payload` to `v5.0.195`, which includes the new `daemonName` field on the `ECSTask` proto
([DataDog/agent-payload#456](DataDog/agent-payload#456)).
### Motivation
With ECS Managed Instances daemon scheduling, a single agent runs once per host and needs to enumerate every task on the instance. AWS shipped the new `/tasks` host endpoint for this, and exposes `Group` (rather than the originally proposed `DaemonName` field) as the daemon-task discriminator.
This is the agent-side prerequisite for correct `ecs_daemon_name` and `daemon-task-definition-arn` tagging in the backend.
### Describe how you validated your changes
**Unit tests**
- `GetTasks` on the v3or4 client.
- `parseTasksFromV4TasksEndpoint` in the workloadmeta collector — daemon-name derivation from `Group` and stale-task
unset behavior.
- `setTaskCollectionParserForDaemon` — selection on Managed Instances vs. EC2.
- `BuildDaemonARN` and `parseDaemonNameFromGroup` (incl. the theoretical `"daemon:"` empty suffix).
- `TestParseV4TaskDaemonGroup` / `TestParseV4TaskServiceGroup` — end-to-end population of DaemonName/DaemonARN vs.
ServiceName/ServiceARN on the `ECSTask` entity.
- `TestHandleECSTask` — new "ECS Managed Instances daemon task" case asserts `daemon_arn` and `ecs_daemon` tag
emission.
- `ExtractECSTask` continues to populate `DaemonName` on the proto.
Deployed agent onto ECS MI using a daemon:
- confirmed that ECS tasks are reported and appear under ECS Explorer
<img width="1051" height="407" alt="image" src="https://github.com/user-attachments/assets/923ffed6-58e6-4ab1-892e-fb437d3e8249" />
- we're also able to extract relevant daemon tags
<img width="776" height="102" alt="image" src="https://github.com/user-attachments/assets/31ece2fd-a8ef-4f75-b5ce-e67a9ed65956" />
- daemon_arn and ecs_daemon present on metrics
<img width="852" height="147" alt="image" src="https://github.com/user-attachments/assets/542d9d11-e485-453f-ba98-6e3d7b6bd6f5" />
Co-authored-by: steve.zou <steve.zou@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds new field
daemonNameto the ECSTask proto. This field indicates that the ECS task is part of an ECS daemon.Motivation
With the release of Daemons on ECS Managed Instances, we now have a new
daemonresource type. We need to identify that an ECS Task belongs to an ECS daemon as opposed to an ECS service.Additional Notes
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Reviewer's Checklist
Reviewers: please see the review guidelines.