improve(go.d/smartctl): add configurable concurrent device scanning#20569
Merged
ilyam8 merged 3 commits intonetdata:masterfrom Jun 24, 2025
Merged
improve(go.d/smartctl): add configurable concurrent device scanning#20569ilyam8 merged 3 commits intonetdata:masterfrom
ilyam8 merged 3 commits intonetdata:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds configurable concurrent scanning for devices in the smartctl collector to improve performance when monitoring many devices. Key changes include:
- Introducing the new concurrent_scans configuration in YAML, JSON, metadata, and schema.
- Updating documentation and examples to describe concurrent scanning behavior.
- Implementing concurrent scanning logic in the collector and adding corresponding test cases.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/go/plugin/go.d/collector/smartctl/testdata/config.yaml | Added concurrent_scans field to YAML configuration. |
| src/go/plugin/go.d/collector/smartctl/testdata/config.json | Added concurrent_scans field to JSON configuration. |
| src/go/plugin/go.d/collector/smartctl/metadata.yaml | Updated metadata and examples to document concurrent scanning. |
| src/go/plugin/go.d/collector/smartctl/config_schema.json | Updated configuration schema to include concurrent_scans. |
| src/go/plugin/go.d/collector/smartctl/collector_test.go | Added a new test case for concurrent scanning devices. |
| src/go/plugin/go.d/collector/smartctl/collector.go | Set default ConcurrentScans value in the Collector configuration. |
| src/go/plugin/go.d/collector/smartctl/collect.go | Implemented concurrent scanning logic and merged results concurrently using a pool. |
Comments suppressed due to low confidence (2)
src/go/plugin/go.d/collector/smartctl/collect.go:54
- The concurrent scanning is only enabled when more than one device is present. If a single device may still benefit from concurrent treatment in future scenarios, consider documenting this behavior or adjusting the condition.
if c.ConcurrentScans > 0 && len(c.scannedDevices) > 1 {
src/go/plugin/go.d/collector/smartctl/collect.go:84
- Merging metrics with maps.Copy overwrites keys from previous devices if duplicated. Ensure that device-specific metric keys are unique or adjust the merging strategy to prevent potential data loss.
maps.Copy(mx, tempMx)
stelfrag
previously approved these changes
Jun 24, 2025
stelfrag
approved these changes
Jun 24, 2025
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.
Summary
Test Plan
Additional Information
For users: How does this change affect me?