Skip to content

Refactor AWS NVMe Scraper for Easier Device Extensibility #1817

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

Merged
merged 4 commits into from
Aug 18, 2025

Conversation

Paramadon
Copy link
Contributor

@Paramadon Paramadon commented Aug 12, 2025

Description

This PR refactors the awsnvmereceiver by introducing the DeviceInfoProvider interface to abstract device-specific operations. The scraper now interacts with NVMe devices through this interface instead of hardcoded switch logic, making it easier to add new device types, improve testability, and maintain the code.

Interface Description:

Model() string – Returns the device model name.

DeviceType() string – Returns a unique type identifier for the device.

Identifier(serial string) (string, error) – Converts a device serial to a unique identifier; validates input.

SetResourceAttribute(rb *metadata.ResourceBuilder, identifier string) – Sets the device-specific resource attributes for metrics.

RecordMetrics(recordMetric RecordMetricFunc, mb *metadata.MetricsBuilder, ts pcommon.Timestamp, metrics Metrics) – Records metrics using a typed function and device-specific metrics.

IsEnabled(m *metadata.MetricsConfig) bool – Indicates whether scraping is enabled for this device type.

ParseRawData(data []byte) (Metrics, error) – Parses raw NVMe data into a strongly typed Metrics object.

In order to add a new nvme device we would just need to implement this interface and we should be able to get those nvme metrics.

Testing

Manually tested and was able to get metrics:
Screenshot 2025-08-12 at 2 13 19 PM

@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch 2 times, most recently from c7f5bd0 to 80f8394 Compare August 12, 2025 19:40
@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch from 80f8394 to 5988b17 Compare August 13, 2025 15:14
@Paramadon Paramadon changed the title Refactoring awsnvmereceiver to encapsulate device functionalities int… Refactor AWS NVMe Scraper for Easier Device Extensibility Aug 13, 2025
@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch 6 times, most recently from e47046e to b6dabc2 Compare August 13, 2025 19:56
@Paramadon Paramadon marked this pull request as ready for review August 14, 2025 14:08
@Paramadon Paramadon requested a review from a team as a code owner August 14, 2025 14:08
@Paramadon Paramadon added the ready for testing Indicates this PR is ready for integration tests to run label Aug 14, 2025
@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch from b6dabc2 to c96f14e Compare August 14, 2025 18:07
@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch 4 times, most recently from f2b2f2b to a38f64e Compare August 15, 2025 21:26
zhihonl
zhihonl previously approved these changes Aug 15, 2025
@Paramadon Paramadon force-pushed the paramadon/InterfaceNvmeReceiver branch from 8f317ea to 46a8df8 Compare August 15, 2025 22:22
@Paramadon Paramadon merged commit 47e9a5d into main Aug 18, 2025
190 of 192 checks passed
@Paramadon Paramadon deleted the paramadon/InterfaceNvmeReceiver branch August 18, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for testing Indicates this PR is ready for integration tests to run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants