containerd-shim-wasm 0.6.0

Library for building containerd shims for wasm
1
2
3
4
5
6
7
8
9
10
11
12
use anyhow::Result;
use containerd_shim::cgroup::collect_metrics;
use containerd_shim::util::convert_to_any;
use protobuf::well_known_types::any::Any;

#[cfg_attr(feature = "tracing", tracing::instrument(parent = tracing::Span::current(), skip_all, level = "Info"))]
pub fn get_metrics(pid: u32) -> Result<Any> {
    let metrics = collect_metrics(pid)?;

    let metrics = convert_to_any(Box::new(metrics))?;
    Ok(metrics)
}