amazon-cloudwatch-agent
amazon-cloudwatch-agent copied to clipboard
Change Prometheus "instance" value
Is your feature request related to a problem? Please describe.
For a Fargate task, the CW Agent for Prometheus emits instance
to be the VPC IP address (plus port) of the container. For forensics investigation (ie. which task instance is this that is complaining?), this is not immediately helpful (through a number of queries, one could wander their way back to the task instance, but not as easily as knowing the task instance already.)
For example from a cwagent-ecs-file-sd-config
log entry:
...
"instance": "172.31.14.84:9404"
...
Describe the solution you'd like
For the instance
value, it would be nice for it to be the task instance id (e.g 7bd02f006a93486ab9bdc77e86c2bd68
- not the Task Definition); if there can exist a 1-N mapping of task instance and container instance, then the instance
value would be better as the Container Runtime Id, as opposed to the VPC IP address.
Describe alternatives you've considered Post processing of the IP address can be done, but for the Cloud Watch graph experience lending itself to immediate container drill-down, i am ignorant of a nice pain-free way to do this.
This issue was marked stale due to lack of activity.
If not change the instance
label to be the task ID, could at least have an additional label like TaskId
or similar. Then folks could relabel as desired.
Turns out the TaskId
label was already added a wee while ago with PR https://github.com/aws/amazon-cloudwatch-agent/pull/334, I was just using quite an old version 😅
To get the ID as an instance label, could use this relabel config to set it
- source_labels: [TaskId]
target_label: instance