Sysmonvm pkg refresh #2307
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!2307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2307/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: #1746
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1746
Original created: 2025-10-12T06:44:32Z
Original updated: 2025-10-12T17:59:59Z
Original head: carverauto/serviceradar:sysmonvm-pkg-refresh
Original base: main
Original merged: 2025-10-12T17:59:56Z by @mfreeman451
PR Type
Enhancement
Description
Embed macOS IOReport frequency sampler into Go binary
Remove standalone hostfreq binary and launchd service
Refactor cpufreq collector with cgo bridge
Update build system and packaging scripts
Diagram Walkthrough
File Walkthrough
6 files
Refactor collector to use embedded hostfreq functionAdd Darwin-specific cgo bridge for IOReport samplingAdd stub implementation for non-Darwin platformsConvert standalone binary to cgo library functionsAdd C header for cgo bridge interfaceAdd C++ wrapper for Objective-C++ implementation1 files
Update tests for new hostfreq collector interface11 files
Remove hostfreq binary installation and launchd serviceUpdate packaging to exclude hostfreq binaryUpdate platform configuration pathsUpdate workflow to target cpufreq packageAdd hostfreq object compilation and cgo build supportRemove hostfreq binary build targetRemove hostfreq binary build rulesRemove hostfreq launchd service configurationRemove hostfreq environment variable from checker serviceRemove hostfreq binary from packaging targetsAdd cgo library build configuration for Darwin4 files
Update documentation for embedded sampler approachUpdate documentation for integrated approachUpdate documentation for embedded sampler strategyUpdate runbook for simplified deployment processImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1746#issuecomment-3393993000
Original created: 2025-10-12T06:45:16Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Native memory leak
Description: C-allocated buffers are returned to Go via cgo (using malloc) and require explicit
freeing; if Go code does not always call
hostfreq_freeon bothoutJSONandoutError, itcan leak memory across repeated calls.
hostfreq_darwin.mm [481-486]
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/1746#issuecomment-3393993829
Original created: 2025-10-12T06:46:41Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Simplify the cgo build process
Unify the build process by removing the manual
Makefilepre-compilation of theObjective-C++ object file. Instead, rely solely on standard
cgodirectives tolet the Go toolchain manage the compilation, simplifying the build logic and
eliminating the need for a dual build system with Bazel.
Examples:
Makefile [76-86]
pkg/cpufreq/hostfreq_darwin.go [1-11]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a significant design flaw where two separate and complex build systems (
makeandBazel) are used for the same cgo component, increasing maintenance overhead and fragility. Unifying the build process would be a major improvement.Make CGo call respect context
Refactor
collectViaHostfreqto run the blocking CGo call in a separategoroutine, allowing the function to respect context cancellation via a
selectstatement.
pkg/cpufreq/hostfreq_darwin.go [44-130]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies that the blocking CGo call does not respect context cancellation and proposes a standard Go pattern to fix it, which prevents potential goroutine leaks and makes the function properly cancellable.
Fix a memory leak
Add a call to
CFRelease(subscription)in an error path withinCollectJsonInternalto prevent a memory leak ifIOReportCreateSubscriptionpartially fails.
pkg/cpufreq/hostfreq_darwin.mm [333-417]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a memory leak in an error path for a newly added C++ function and provides the correct fix, improving the robustness of the code.