Skip to content

enhancement(host_metrics source): replace heim with sysinfo in network collector#24818

Open
mushrowan wants to merge 1 commit intovectordotdev:masterfrom
mushrowan:feat/host-metrics-network-sysinfo
Open

enhancement(host_metrics source): replace heim with sysinfo in network collector#24818
mushrowan wants to merge 1 commit intovectordotdev:masterfrom
mushrowan:feat/host-metrics-network-sysinfo

Conversation

@mushrowan
Copy link
Copy Markdown
Contributor

@mushrowan mushrowan commented Mar 1, 2026

Summary

replace heim::net::io_counters() with sysinfo::Networks in the host_metrics
network collector. first step in removing the unmaintained heim dependency
(#23646). sysinfo is already a dep (used by process.rs)

network_transmit_packets_total now emitted on all platforms (was linux/windows
only). windows tx drops temporarily unavailable since sysinfo doesn't expose
drop counters yet, linux drops preserved via inline sysfs read

Vector configuration

[sources.host_metrics]
type = "host_metrics"
collectors = ["network"]

How did you test this PR?

cargo test -p vector --no-default-features --features sources-host_metrics sources::host_metrics::network

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our
    guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

@mushrowan mushrowan requested a review from a team as a code owner March 1, 2026 11:46
@github-actions github-actions Bot added domain: sources Anything related to the Vector's sources domain: ci Anything related to Vector's CI environment labels Mar 1, 2026
@mushrowan mushrowan force-pushed the feat/host-metrics-network-sysinfo branch from fd5bc2a to 46660f8 Compare March 1, 2026 12:08
…ollector

replace heim::net::io_counters() with sysinfo::Networks for network
metrics collection, as part of removing the unmaintained heim
dependency (vectordotdev#23646)

- sysinfo already a dep (used by process.rs), no new dependencies
- network_transmit_packets_total now emitted on all platforms
  (was linux/windows only behind heim IoCountersExt)
- tx drop counters read from sysfs on linux since sysinfo doesn't
  expose them yet (same /sys/class/net dir sysinfo reads from)
- windows tx drops temporarily unavailable, pending upstream sysinfo
- replaces async stream/filter_map chain with simple sync iteration
@mushrowan mushrowan force-pushed the feat/host-metrics-network-sysinfo branch from 46660f8 to 3a386c6 Compare March 1, 2026 12:10
@mushrowan mushrowan changed the title refactor(host_metrics source): replace heim with sysinfo in network collector enhancement(host_metrics source): replace heim with sysinfo in network collector Mar 1, 2026
Comment on lines +76 to +83
#[cfg(target_os = "linux")]
fn read_sysfs_tx_dropped(interface: &str) -> Option<u64> {
std::fs::read_to_string(format!(
"/sys/class/net/{interface}/statistics/tx_dropped"
))
.ok()
.and_then(|s| s.trim().parse().ok())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heim reads this directly from /proc/net/dev in Linux. We also don't want to drop windows support for network_transmit_packets_drop_total. I'd be more confident in merging this in if this were part of upstream sysinfo. Is there an upstream tracking issue for this?

Exploring an idea: is it possible to use heim to get just this one metric? We can could remove it later of course.

Comment on lines +1 to +6
The `host_metrics` source network collector now uses `sysinfo` instead of the
unmaintained `heim` crate. `network_transmit_packets_total` is now emitted on
all platforms (previously linux/windows only). Windows `network_transmit_packets_drop_total`
is temporarily unavailable pending upstream sysinfo support.

authors: mushrowan
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `host_metrics` source network collector now uses `sysinfo` instead of the
unmaintained `heim` crate. `network_transmit_packets_total` is now emitted on
all platforms (previously linux/windows only). Windows `network_transmit_packets_drop_total`
is temporarily unavailable pending upstream sysinfo support.
authors: mushrowan
The `host_metrics` source now emits `network_transmit_packets_total` on all platforms
(previously Linux and Windows only). Windows `network_transmit_packets_drop_total`
is temporarily unavailable pending upstream sysinfo support.
authors: mushrowan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: ci Anything related to Vector's CI environment domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants