Skip to content

Commit f70901a

Browse files
authored
Check vint_runtime as well as vinternal_1 for network metrics (#557)
* fix: check vint_runtime as well * fix: spelling * feat: fmt
1 parent b2e91c0 commit f70901a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bottlecap/src/proc/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub const PROC_UPTIME_PATH: &str = "/proc/uptime";
44
pub const PROC_PATH: &str = "/proc";
55
pub const ETC_PATH: &str = "/etc";
66

7-
pub const LAMDBA_NETWORK_INTERFACE: &str = "vinternal_1";
7+
pub const LAMBDA_NETWORK_INTERFACE: &str = "vinternal_1";
8+
pub const LAMBDA_RUNTIME_NETWORK_INTERFACE: &str = "vint_runtime";
89
pub const LAMBDA_FILE_DESCRIPTORS_DEFAULT_LIMIT: f64 = 1024.0;
910
pub const LAMBDA_EXECUTION_PROCESSES_DEFAULT_LIMIT: f64 = 1024.0;

bottlecap/src/proc/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use std::{
88
};
99

1010
use constants::{
11-
LAMDBA_NETWORK_INTERFACE, PROC_NET_DEV_PATH, PROC_PATH, PROC_STAT_PATH, PROC_UPTIME_PATH,
11+
LAMBDA_NETWORK_INTERFACE, LAMBDA_RUNTIME_NETWORK_INTERFACE, PROC_NET_DEV_PATH, PROC_PATH,
12+
PROC_STAT_PATH, PROC_UPTIME_PATH,
1213
};
1314
use regex::Regex;
1415
use tracing::{debug, trace};
@@ -60,7 +61,8 @@ fn get_network_data_from_path(path: &str) -> Result<NetworkData, io::Error> {
6061
let mut values = line.split_whitespace();
6162

6263
if values.next().map_or(false, |interface_name| {
63-
interface_name.starts_with(LAMDBA_NETWORK_INTERFACE)
64+
interface_name.starts_with(LAMBDA_NETWORK_INTERFACE)
65+
|| interface_name.starts_with(LAMBDA_RUNTIME_NETWORK_INTERFACE)
6466
}) {
6567
// Read the value for received bytes if present
6668
let rx_bytes: Option<f64> = values.next().and_then(|s| s.parse().ok());

0 commit comments

Comments
 (0)