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

runtime: remove kata_shim_netdev metric #9100

Merged
merged 2 commits into from
Feb 26, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/runtime-rs/crates/runtimes/src/shim_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ lazy_static! {

static ref SHIM_PROC_STAT: GaugeVec = GaugeVec::new(Opts::new(format!("{}_{}",NAMESPACE_KATA_SHIM,"proc_stat"), "Kata containerd shim v2 process statistics."), &["item"]).unwrap();

static ref SHIM_NETDEV: GaugeVec = GaugeVec::new(Opts::new(format!("{}_{}",NAMESPACE_KATA_SHIM,"netdev"), "Kata containerd shim v2 network devices statistics."), &["interface", "item"]).unwrap();

static ref SHIM_IO_STAT: GaugeVec = GaugeVec::new(Opts::new(format!("{}_{}",NAMESPACE_KATA_SHIM,"io_stat"), "Kata containerd shim v2 process IO statistics."), &["item"]).unwrap();

static ref SHIM_OPEN_FDS: Gauge = Gauge::new(format!("{}_{}", NAMESPACE_KATA_SHIM, "fds"), "Kata containerd shim v2 open FDs.").unwrap();
Expand Down Expand Up @@ -66,7 +64,6 @@ fn register_shim_metrics() -> Result<()> {
REGISTRY.register(Box::new(SHIM_THREADS.clone()))?;
REGISTRY.register(Box::new(SHIM_PROC_STATUS.clone()))?;
REGISTRY.register(Box::new(SHIM_PROC_STAT.clone()))?;
REGISTRY.register(Box::new(SHIM_NETDEV.clone()))?;
REGISTRY.register(Box::new(SHIM_IO_STAT.clone()))?;
REGISTRY.register(Box::new(SHIM_OPEN_FDS.clone()))?;

Expand Down Expand Up @@ -105,17 +102,6 @@ fn update_shim_metrics() -> Result<()> {
}
}

match procfs::net::dev_status() {
Err(err) => {
error!(sl!(), "failed to get host net::dev_status: {:?}", err);
}
Ok(devs) => {
for (_, status) in devs {
set_gauge_vec_netdev(&SHIM_NETDEV, &status);
}
}
}

match me.io() {
Err(err) => {
error!(sl!(), "failed to get process io stat: {:?}", err);
Expand Down Expand Up @@ -186,41 +172,6 @@ fn set_gauge_vec_proc_stat(gv: &prometheus::GaugeVec, stat: &procfs::process::St
gv.with_label_values(&["cstime"]).set(stat.cstime as f64);
}

fn set_gauge_vec_netdev(gv: &prometheus::GaugeVec, status: &procfs::net::DeviceStatus) {
gv.with_label_values(&[status.name.as_str(), "recv_bytes"])
.set(status.recv_bytes as f64);
gv.with_label_values(&[status.name.as_str(), "recv_packets"])
.set(status.recv_packets as f64);
gv.with_label_values(&[status.name.as_str(), "recv_errs"])
.set(status.recv_errs as f64);
gv.with_label_values(&[status.name.as_str(), "recv_drop"])
.set(status.recv_drop as f64);
gv.with_label_values(&[status.name.as_str(), "recv_fifo"])
.set(status.recv_fifo as f64);
gv.with_label_values(&[status.name.as_str(), "recv_frame"])
.set(status.recv_frame as f64);
gv.with_label_values(&[status.name.as_str(), "recv_compressed"])
.set(status.recv_compressed as f64);
gv.with_label_values(&[status.name.as_str(), "recv_multicast"])
.set(status.recv_multicast as f64);
gv.with_label_values(&[status.name.as_str(), "sent_bytes"])
.set(status.sent_bytes as f64);
gv.with_label_values(&[status.name.as_str(), "sent_packets"])
.set(status.sent_packets as f64);
gv.with_label_values(&[status.name.as_str(), "sent_errs"])
.set(status.sent_errs as f64);
gv.with_label_values(&[status.name.as_str(), "sent_drop"])
.set(status.sent_drop as f64);
gv.with_label_values(&[status.name.as_str(), "sent_fifo"])
.set(status.sent_fifo as f64);
gv.with_label_values(&[status.name.as_str(), "sent_colls"])
.set(status.sent_colls as f64);
gv.with_label_values(&[status.name.as_str(), "sent_carrier"])
.set(status.sent_carrier as f64);
gv.with_label_values(&[status.name.as_str(), "sent_compressed"])
.set(status.sent_compressed as f64);
}

fn set_gauge_vec_proc_io(gv: &prometheus::GaugeVec, io_stat: &procfs::process::Io) {
gv.with_label_values(&["rchar"]).set(io_stat.rchar as f64);
gv.with_label_values(&["wchar"]).set(io_stat.wchar as f64);
Expand Down
17 changes: 0 additions & 17 deletions src/runtime/pkg/containerd-shim-v2/shim_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ var (
[]string{"item"},
)

katashimNetdev = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespaceKatashim,
Name: "netdev",
Help: "Kata containerd shim v2 network devices statistics.",
},
[]string{"interface", "item"},
)

katashimIOStat = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespaceKatashim,
Name: "io_stat",
Expand Down Expand Up @@ -89,7 +81,6 @@ func registerMetrics() {
prometheus.MustRegister(katashimThreads)
prometheus.MustRegister(katashimProcStatus)
prometheus.MustRegister(katashimProcStat)
prometheus.MustRegister(katashimNetdev)
prometheus.MustRegister(katashimIOStat)
prometheus.MustRegister(katashimOpenFDs)
prometheus.MustRegister(katashimPodOverheadCPU)
Expand All @@ -108,14 +99,6 @@ func updateShimMetrics() error {
katashimOpenFDs.Set(float64(fds))
}

// network device metrics
if netdev, err := proc.NetDev(); err == nil {
// netdev: map[string]NetDevLine
for _, v := range netdev {
mutils.SetGaugeVecNetDev(katashimNetdev, v)
}
}

// proc stat
if procStat, err := proc.Stat(); err == nil {
katashimThreads.Set(float64(procStat.NumThreads))
Expand Down