-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add volume ID append dimension for disk metrics #1156
Merged
Merged
Conversation
This file contains 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
mitali-salvi
reviewed
May 2, 2024
sethAmazon
reviewed
May 2, 2024
What is the volume id for non disk metrics? Does it use the default device? |
Can you please do a macos test |
mitali-salvi
approved these changes
May 2, 2024
sethAmazon
approved these changes
May 2, 2024
sethAmazon
added a commit
that referenced
this pull request
May 7, 2024
This reverts commit e46fae5.
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.
Description of the issue
CloudWatch agent enables customers to collect disc utilization metrics from hosts including total, used, free, and used_percent. The cardinality of these metrics includes the following dimensions: device (e.g. xvdb), filesystem path (e.g. /mnt/volume), and filesystem type (e.g. ext4). Device is the logical representation of a partition on a volume. There can be more than one partition in a volume.
Customers cannot determine which of their volumes are over provisioned without post processing of these metrics to aggregate all of a metric over a device. Furthermore, since device is not synonymous with a volume, customers cannot aggregate usage on volumes with more than one partition. Also, for instances that use the Nitro system, the device names change for each disk mount when the instance is rebooted, so in those cases device cannot be used to monitor disk usage.
The EC2 tagger already supports this dimension, but was broken and unconfigurable.
Description of changes
To enable volume aggregation,
VolumeId
is being added as an option in the disk metricsappend_dimensions
.If that specific dimension key/value pair is present in the disk metrics, then the agent will cache a device to serial map on start up. This mapping is derived in two ways: from the host (linux only) and from
ec2:DescribeVolumes
.On a linux host, the agent will read the
/sys/block/<device>/device/serial
if available for the serial. This is similar to the gopsutil implementation (although gopsutil includes the model for some reason). For EBS volumes, the serial will bevol0c241693efb58734a
rather than thevol-0303a1cc896c42d28
. In those cases, the serial is formatted to match the volume ID.If
ec2:DescribeVolumes
permissions are provided to the agent, then the agent will make the call and add the mapping derived from the response to the cache as well.If neither are available and the dimension is present, then an error will be logged and the tagger will try again after 3 minutes.
This is only for disk metrics and requires the
device
attribute to be present on the metric when it reaches the EC2 tagger. Therefore, it is not compatible with thedrop_device
field.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
Added unit tests. Built and ran on test hosts.
Requirements
Before commit the code, please do the following steps.
make fmt
andmake fmt-sh
make lint