Skip to content
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

feat: Add per net device metrics #4145

Merged
merged 13 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### Added

- [#4145](https://github.com/firecracker-microvm/firecracker/pull/4145):
Added support for per net device metrics. In addition to aggregate metrics `net`,
each individual net device will emit metrics under the label `"net_{iface_id}"`.
E.g. the associated metrics for the endpoint `"/network-interfaces/eth0"` will
be available under `"net_eth0"` in the metrics json object.

### Changed

- Simplified and clarified the removal policy of deprecated API elements
Expand Down
9 changes: 6 additions & 3 deletions src/vmm/src/devices/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ pub mod virtio;
pub use bus::{Bus, BusDevice, BusError};
use log::error;

use crate::devices::virtio::metrics::NetDeviceMetrics;
use crate::devices::virtio::{QueueError, VsockError};
use crate::logger::{IncMetric, METRICS};

// Function used for reporting error in terms of logging
// but also in terms of METRICS net event fails.
pub(crate) fn report_net_event_fail(err: DeviceError) {
// but also in terms of metrics of net event fails.
// network metrics is reported per device so we need a handle to each net device's
// metrics `net_iface_metrics` to report metrics for that device.
pub(crate) fn report_net_event_fail(net_iface_metrics: &NetDeviceMetrics, err: DeviceError) {
error!("{:?}", err);
METRICS.net.event_fails.inc();
net_iface_metrics.event_fails.inc();
}

pub(crate) fn report_balloon_event_fail(err: virtio::balloon::BalloonError) {
Expand Down
Loading