amazon-cloudwatch-agent icon indicating copy to clipboard operation
amazon-cloudwatch-agent copied to clipboard

Fix support for VolumeId dimension on nitro instances

Open montaguethomas opened this issue 7 months ago • 11 comments

Description of the issue

Linux allows mounting disks using a device alias (symlink) but the CWAgent is not able to resolve the EBS VolumeId for the device. Fixes #1727.

When PR #1156 implemented support to use ${aws:VolumeId} for a dimension value, it included extensive normalization of the device name:

https://github.com/aws/amazon-cloudwatch-agent/blob/4123ffc888f6e864cc5a75ee653033464a2a9783/plugins/processors/ec2tagger/internal/volume/volume.go#L109-L145

This linux specific logic runs for all platforms, prevents the device names returned by the describeVolumesProvider (DescribeVolumes.Volumes.Attachments) from being included in the volume cache map. This normalization is not needed for the results of the linux hostProvider as it enumerates the devices registered in /sys/block/.

Description of changes

  • Move normalization of device name (trimming prefix /dev/) to describeVolumesProvider.DeviceToSerialMap method.
  • Remove normalization from volume provider.
  • Enables support for having multiple device names in volume cache with the same device serial (volumeId).

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

  • Updated and ran unit tests.
  • Built linux binary and tested on above system.

Requirements

Before commiting your code, please do the following steps.

  • [x] Run make fmt and make fmt-sh
  • [x] Run make lint

Integration Tests

To run integration tests against this PR, add the ready for testing label.

montaguethomas avatar Jun 15 '25 02:06 montaguethomas

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Jun 28 '25 00:06 github-actions[bot]

This PR was marked stale due to lack of activity.

poke

montaguethomas avatar Jun 28 '25 13:06 montaguethomas

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Jul 07 '25 00:07 github-actions[bot]

bump

montaguethomas avatar Sep 22 '25 15:09 montaguethomas

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Oct 01 '25 00:10 github-actions[bot]

ping

montaguethomas avatar Nov 05 '25 15:11 montaguethomas

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Nov 13 '25 00:11 github-actions[bot]

ping

montaguethomas avatar Nov 13 '25 00:11 montaguethomas

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Nov 23 '25 00:11 github-actions[bot]