Closed Mossaka closed 3 months ago
Do we need to maintain one more crate for this? This seems to be achievable with:
#[cfg_attr(feature = "tracing", tracing::instrument)]
Do we need to maintain one more crate for this? This seems to be achievable with:
#[cfg_attr(feature = "tracing", tracing::instrument)]
Ah yeah this looks like a better idea 👍.
Same applies to level.
Unless overridden, a span with the [INFO] will be generated.
This PR introduces
tracing
instrumentation to the shim crate. It will allow us to collect detailed function entry and exit, args and returns to understand the behaviour of the shim process.An use case for runwasi shim is that it will collect the traces and transform them to OTLP traces and output them to an jeager endpoint (see https://github.com/containerd/runwasi/pull/582).
From my observation the perf overhead with tracing macros is minimal. If this is a concern, we can try disabling tracing staticlly. Statically, we may use rust conditional compilation feature to add either compile or ignore tracing macros that are added to each function.Update: I've created a new
shim_instrument
proc-macro that will statically disable/enable tracing for each function. if the featuretracing
is not enabled, theinstrument
macro is acts as a no-opt. Otherwise, it will applytracing::instrument
to that function.