Feat/docker cpu monitoring #2302
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2302
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2302/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1736
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1736
Original created: 2025-10-10T05:55:21Z
Original updated: 2025-10-11T04:59:50Z
Original head: carverauto/serviceradar:feat/docker_cpu_monitoring
Original base: main
Original merged: 2025-10-11T04:59:41Z by @mfreeman451
PR Type
Enhancement
Description
Add CPU frequency monitoring to sysmon metrics
Create dedicated
sysmon-vmgRPC checker serviceImplement CPU frequency collector using sysfs/procfs
Extend database schema with
frequency_hzcolumnDiagram Walkthrough
File Walkthrough
11 files
New sysmon-vm checker service main entry pointgRPC service implementation with CPU metricsAdd frequency_hz to CPU metrics APIInclude frequency data in sysmon processingCPU frequency collector using sysfs/procfsUpdate database queries for frequency columnAdd frequency field to metrics storageAdd FrequencyHz field to CPUMetric modelAdd frequency_hz column to base schemaMigration rollback for frequency columnMigration to add frequency column3 files
Register sysmon-vm service in agent registryConfiguration structure for sysmon-vm checkerExample configuration file for sysmon-vm1 files
Code formatting improvements in poller2 files
Documentation for sysmon-vm checker deploymentImplementation plan and operational checklist2 files
Add gopsutil dependency for system metricsUpdate dependency checksums for gopsutilImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1736#issuecomment-3388390549
Original created: 2025-10-10T05:56:03Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
External network dial
Description: The function
localIP()dials an external UDP address ("8.8.8.8:80") to infer the local IP,which can leak network metadata and may fail or hang in restricted environments; consider
using local interface inspection instead.
service.go [172-185]
Referred Code
SQL injection
Description: Building SQL with fmt.Sprintf that interpolates
device_idand timestamps directly risksSQL injection if any value is untrusted; use parameterized queries instead.
sysmon.go [394-402]
Referred Code
Path traversal
Description: Reading from
/sys/devices/system/cpu/.../scaling_cur_freqwithout constrainingcoretoexpected bounds could allow path probing if core count is spoofed upstream; validate
indices strictly against
cpu.Countsand construct paths defensively.collector.go [98-117]
Referred Code
🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
No custom compliance provided
Follow the guide to enable custom compliance check.
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1736#issuecomment-3388392458
Original created: 2025-10-10T05:57:19Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Improve local IP address discovery
Improve the
localIPfunction by removing its dependency on an external server.The suggested implementation iterates over the host's network interfaces to find
a suitable non-loopback IP address, making it more robust.
pkg/checker/sysmonvm/service.go [172-185]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that dialing an external address to find the local IP is fragile and proposes a more robust, dependency-free alternative by iterating over local network interfaces. This improves the reliability of the checker in environments without internet access.
Improve file reading performance for sysfs
Optimize the
readSysfsfunction for better performance when reading small sysfsfiles. Replace
os.ReadFilewithos.Openand a fixed-size buffer to reduce memoryallocations.
pkg/cpufreq/collector.go [98-118]
Suggestion importance[1-10]: 4
__
Why: The suggestion offers a valid micro-optimization for reading small sysfs files by using
os.Openand a buffer instead ofos.ReadFile. While correct, the performance impact is likely minimal given the small file size and context of the application.